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 
37 	@Before
38 	public void setUp() throws Exception {
39 		app.start();
40 	}
41 
42 	@After
43 	public void tearDown() throws Exception {
44 		app.stop();
45 	}
46 
47 	/**
48 	 * Test the Table Background property dialog in Presentation
49 	 *
50 	 * @throws Exception
51 	 */
52 
53 	@Test
54 	public void testTableBackgroundPropertyDialog() throws Exception {
55 		AppTool.newPresentation();
56 
57 		// Insert a table
58 		app.dispatch(".uno:InsertTable", 3);
59 		insertTable.ok();
60 
61 		// Verify if the table toolbar is active
62 		assertTrue(tableToolbar.exists(3));
63 
64 		// open Table Properties Dialog
65 		app.dispatch(".uno:TableDialog", 3);
66 		areaAreapage.select();
67 		// select Color
68 		areaFillType.select(1);
69 		assertEquals("Area_Fill_Type is not Color", areaFillType.getSelText(), areaFillType.getItemText(1));
70 		areaFillColor.select(2);
71 		// Area_Fill_Color.getItemCount();
72 		assertEquals("Area_Fill_Color is not the second item", areaFillColor.getSelText(), areaFillColor.getItemText(2));
73 		areaAreapage.ok();
74 
75 		// open Table Properties Dialog
76 		app.dispatch(".uno:TableDialog", 3);
77 		areaAreapage.select();
78 		// select Gradient
79 		areaFillType.select(2);
80 		assertEquals("Area_Fill_Type is not Gradient", areaFillType.getSelText(), areaFillType.getItemText(2));
81 		areaFillGradient.select(2);
82 		assertEquals("Area_Fill_Gradient is not the second item", areaFillGradient.getSelText(), areaFillGradient.getItemText(2));
83 		areaAreapage.ok();
84 
85 		// open Table Properties Dialog
86 		app.dispatch(".uno:TableDialog", 3);
87 		areaAreapage.select();
88 		// select Hatching
89 		areaFillType.select(3);
90 		assertEquals("Area_Fill_Type is not Hatching", areaFillType.getSelText(), areaFillType.getItemText(3));
91 		areaFillHatching.select(2);
92 		assertEquals("Area_Fill_Hatching is not the second item", areaFillHatching.getSelText(), areaFillHatching.getItemText(2));
93 		areaAreapage.ok();
94 
95 		// open Table Properties Dialog
96 		app.dispatch(".uno:TableDialog", 3);
97 		areaAreapage.select();
98 		// select Bitmap
99 		areaFillType.select(4);
100 		assertEquals("Area_Fill_Type is not Bitmap", areaFillType.getSelText(), areaFillType.getItemText(4));
101 		areaFillBitmap.select(2);
102 		assertEquals("Area_Fill_Bitmap is not the second item", areaFillBitmap.getSelText(), areaFillBitmap.getItemText(2));
103 		areaAreapage.ok();
104 
105 	}
106 
107 }
108