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