xref: /AOO41X/test/testgui/source/fvt/gui/sd/table/TableBackgroundProperty.java (revision fd3484265709667881cfaec27d41da15d46b6832)
1c37bcbf4SLi Feng Wang /**************************************************************
2c37bcbf4SLi Feng Wang  *
3c37bcbf4SLi Feng Wang  * Licensed to the Apache Software Foundation (ASF) under one
4c37bcbf4SLi Feng Wang  * or more contributor license agreements.  See the NOTICE file
5c37bcbf4SLi Feng Wang  * distributed with this work for additional information
6c37bcbf4SLi Feng Wang  * regarding copyright ownership.  The ASF licenses this file
7c37bcbf4SLi Feng Wang  * to you under the Apache License, Version 2.0 (the
8c37bcbf4SLi Feng Wang  * "License"); you may not use this file except in compliance
9c37bcbf4SLi Feng Wang  * with the License.  You may obtain a copy of the License at
10c37bcbf4SLi Feng Wang  *
11c37bcbf4SLi Feng Wang  *   http://www.apache.org/licenses/LICENSE-2.0
12c37bcbf4SLi Feng Wang  *
13c37bcbf4SLi Feng Wang  * Unless required by applicable law or agreed to in writing,
14c37bcbf4SLi Feng Wang  * software distributed under the License is distributed on an
15c37bcbf4SLi Feng Wang  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c37bcbf4SLi Feng Wang  * KIND, either express or implied.  See the License for the
17c37bcbf4SLi Feng Wang  * specific language governing permissions and limitations
18c37bcbf4SLi Feng Wang  * under the License.
19c37bcbf4SLi Feng Wang  *
20c37bcbf4SLi Feng Wang  *************************************************************/
21c37bcbf4SLi Feng Wang 
22c37bcbf4SLi Feng Wang package fvt.gui.sd.table;
23c37bcbf4SLi Feng Wang 
24c37bcbf4SLi Feng Wang import static org.junit.Assert.*;
25c37bcbf4SLi Feng Wang import static testlib.gui.UIMap.*;
26c37bcbf4SLi Feng Wang 
27c37bcbf4SLi Feng Wang import org.junit.After;
28c37bcbf4SLi Feng Wang import org.junit.Before;
29c37bcbf4SLi Feng Wang import org.junit.Rule;
30c37bcbf4SLi Feng Wang import org.junit.Test;
31c37bcbf4SLi Feng Wang import org.openoffice.test.common.Logger;
32c37bcbf4SLi Feng Wang 
33c37bcbf4SLi Feng Wang import testlib.gui.AppTool;
34c37bcbf4SLi Feng Wang 
35c37bcbf4SLi Feng Wang public class TableBackgroundProperty {
36*fd348426SLi Feng Wang 	@Rule
37*fd348426SLi Feng Wang 	public Logger log = Logger.getLogger(this);
38c37bcbf4SLi Feng Wang 
39c37bcbf4SLi Feng Wang 	@Before
setUp()40c37bcbf4SLi Feng Wang 	public void setUp() throws Exception {
41c37bcbf4SLi Feng Wang 		app.start();
42c37bcbf4SLi Feng Wang 	}
43c37bcbf4SLi Feng Wang 
44c37bcbf4SLi Feng Wang 	@After
tearDown()45c37bcbf4SLi Feng Wang 	public void tearDown() throws Exception {
46c37bcbf4SLi Feng Wang 		app.stop();
47c37bcbf4SLi Feng Wang 	}
48c37bcbf4SLi Feng Wang 
49c37bcbf4SLi Feng Wang 	/**
50c37bcbf4SLi Feng Wang 	 * Test the Table Background property dialog in Presentation
51c37bcbf4SLi Feng Wang 	 *
52c37bcbf4SLi Feng Wang 	 * @throws Exception
53c37bcbf4SLi Feng Wang 	 */
54c37bcbf4SLi Feng Wang 
55c37bcbf4SLi Feng Wang 	@Test
testTableBackgroundPropertyDialog()56c37bcbf4SLi Feng Wang 	public void testTableBackgroundPropertyDialog() throws Exception {
57c37bcbf4SLi Feng Wang 		AppTool.newPresentation();
58c37bcbf4SLi Feng Wang 
59c37bcbf4SLi Feng Wang 		// Insert a table
60c37bcbf4SLi Feng Wang 		app.dispatch(".uno:InsertTable", 3);
61c37bcbf4SLi Feng Wang 		insertTable.ok();
62c37bcbf4SLi Feng Wang 
63c37bcbf4SLi Feng Wang 		// Verify if the table toolbar is active
64c37bcbf4SLi Feng Wang 		assertTrue(tableToolbar.exists(3));
65c37bcbf4SLi Feng Wang 
66c37bcbf4SLi Feng Wang 		// open Table Properties Dialog
67c37bcbf4SLi Feng Wang 		app.dispatch(".uno:TableDialog", 3);
68c37bcbf4SLi Feng Wang 		areaAreapage.select();
69c37bcbf4SLi Feng Wang 		// select Color
70c37bcbf4SLi Feng Wang 		areaFillType.select(1);
71c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Color", areaFillType.getSelText(), areaFillType.getItemText(1));
72c37bcbf4SLi Feng Wang 		areaFillColor.select(2);
73c37bcbf4SLi Feng Wang 		// Area_Fill_Color.getItemCount();
74c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Color is not the second item", areaFillColor.getSelText(), areaFillColor.getItemText(2));
75c37bcbf4SLi Feng Wang 		areaAreapage.ok();
76c37bcbf4SLi Feng Wang 
77c37bcbf4SLi Feng Wang 		// open Table Properties Dialog
78c37bcbf4SLi Feng Wang 		app.dispatch(".uno:TableDialog", 3);
79c37bcbf4SLi Feng Wang 		areaAreapage.select();
80c37bcbf4SLi Feng Wang 		// select Gradient
81c37bcbf4SLi Feng Wang 		areaFillType.select(2);
82c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Gradient", areaFillType.getSelText(), areaFillType.getItemText(2));
83c37bcbf4SLi Feng Wang 		areaFillGradient.select(2);
84c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Gradient is not the second item", areaFillGradient.getSelText(), areaFillGradient.getItemText(2));
85c37bcbf4SLi Feng Wang 		areaAreapage.ok();
86c37bcbf4SLi Feng Wang 
87c37bcbf4SLi Feng Wang 		// open Table Properties Dialog
88c37bcbf4SLi Feng Wang 		app.dispatch(".uno:TableDialog", 3);
89c37bcbf4SLi Feng Wang 		areaAreapage.select();
90c37bcbf4SLi Feng Wang 		// select Hatching
91c37bcbf4SLi Feng Wang 		areaFillType.select(3);
92c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Hatching", areaFillType.getSelText(), areaFillType.getItemText(3));
93c37bcbf4SLi Feng Wang 		areaFillHatching.select(2);
94c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Hatching is not the second item", areaFillHatching.getSelText(), areaFillHatching.getItemText(2));
95c37bcbf4SLi Feng Wang 		areaAreapage.ok();
96c37bcbf4SLi Feng Wang 
97c37bcbf4SLi Feng Wang 		// open Table Properties Dialog
98c37bcbf4SLi Feng Wang 		app.dispatch(".uno:TableDialog", 3);
99c37bcbf4SLi Feng Wang 		areaAreapage.select();
100c37bcbf4SLi Feng Wang 		// select Bitmap
101c37bcbf4SLi Feng Wang 		areaFillType.select(4);
102c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Bitmap", areaFillType.getSelText(), areaFillType.getItemText(4));
103c37bcbf4SLi Feng Wang 		areaFillBitmap.select(2);
104c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Bitmap is not the second item", areaFillBitmap.getSelText(), areaFillBitmap.getItemText(2));
105c37bcbf4SLi Feng Wang 		areaAreapage.ok();
106c37bcbf4SLi Feng Wang 
107c37bcbf4SLi Feng Wang 	}
108c37bcbf4SLi Feng Wang 
109c37bcbf4SLi Feng Wang }
110