159f3c9b1SLiu Zhe /**************************************************************
259f3c9b1SLiu Zhe  *
359f3c9b1SLiu Zhe  * Licensed to the Apache Software Foundation (ASF) under one
459f3c9b1SLiu Zhe  * or more contributor license agreements.  See the NOTICE file
559f3c9b1SLiu Zhe  * distributed with this work for additional information
659f3c9b1SLiu Zhe  * regarding copyright ownership.  The ASF licenses this file
759f3c9b1SLiu Zhe  * to you under the Apache License, Version 2.0 (the
859f3c9b1SLiu Zhe  * "License"); you may not use this file except in compliance
959f3c9b1SLiu Zhe  * with the License.  You may obtain a copy of the License at
1059f3c9b1SLiu Zhe  *
1159f3c9b1SLiu Zhe  *   http://www.apache.org/licenses/LICENSE-2.0
1259f3c9b1SLiu Zhe  *
1359f3c9b1SLiu Zhe  * Unless required by applicable law or agreed to in writing,
1459f3c9b1SLiu Zhe  * software distributed under the License is distributed on an
1559f3c9b1SLiu Zhe  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1659f3c9b1SLiu Zhe  * KIND, either express or implied.  See the License for the
1759f3c9b1SLiu Zhe  * specific language governing permissions and limitations
1859f3c9b1SLiu Zhe  * under the License.
1959f3c9b1SLiu Zhe  *
2059f3c9b1SLiu Zhe  *************************************************************/
2159f3c9b1SLiu Zhe 
2280a6f5c5SLiu Zhe package fvt.gui.sd.table;
2359f3c9b1SLiu Zhe 
2459f3c9b1SLiu Zhe import static org.junit.Assert.*;
2522a14f28SLiu Zhe import static testlib.gui.UIMap.*;
2622a14f28SLiu Zhe 
2759f3c9b1SLiu Zhe import org.junit.After;
2859f3c9b1SLiu Zhe import org.junit.Before;
2959f3c9b1SLiu Zhe import org.junit.Rule;
3059f3c9b1SLiu Zhe import org.junit.Test;
3122a14f28SLiu Zhe import org.openoffice.test.common.Logger;
3259f3c9b1SLiu Zhe 
33*c37bcbf4SLi Feng Wang import testlib.gui.AppTool;
34*c37bcbf4SLi Feng Wang 
35*c37bcbf4SLi Feng Wang public class TableBackgroundProperty {
3659f3c9b1SLiu Zhe 
3759f3c9b1SLiu Zhe 	@Before
3859f3c9b1SLiu Zhe 	public void setUp() throws Exception {
3959f3c9b1SLiu Zhe 		app.start();
4059f3c9b1SLiu Zhe 	}
4159f3c9b1SLiu Zhe 
4259f3c9b1SLiu Zhe 	@After
4359f3c9b1SLiu Zhe 	public void tearDown() throws Exception {
44*c37bcbf4SLi Feng Wang 		app.stop();
4559f3c9b1SLiu Zhe 	}
4659f3c9b1SLiu Zhe 
4759f3c9b1SLiu Zhe 	/**
48*c37bcbf4SLi Feng Wang 	 * Test the Table Background property dialog in Presentation
4959f3c9b1SLiu Zhe 	 *
5059f3c9b1SLiu Zhe 	 * @throws Exception
5159f3c9b1SLiu Zhe 	 */
5259f3c9b1SLiu Zhe 
5359f3c9b1SLiu Zhe 	@Test
54*c37bcbf4SLi Feng Wang 	public void testTableBackgroundPropertyDialog() throws Exception {
55*c37bcbf4SLi Feng Wang 		AppTool.newPresentation();
5659f3c9b1SLiu Zhe 
5759f3c9b1SLiu Zhe 		// Insert a table
5859f3c9b1SLiu Zhe 		app.dispatch(".uno:InsertTable", 3);
59b4d2d410SLiu Zhe 		insertTable.ok();
6059f3c9b1SLiu Zhe 
6159f3c9b1SLiu Zhe 		// Verify if the table toolbar is active
62b4d2d410SLiu Zhe 		assertTrue(tableToolbar.exists(3));
6359f3c9b1SLiu Zhe 
6459f3c9b1SLiu Zhe 		// open Table Properties Dialog
6559f3c9b1SLiu Zhe 		app.dispatch(".uno:TableDialog", 3);
66b4d2d410SLiu Zhe 		areaAreapage.select();
6759f3c9b1SLiu Zhe 		// select Color
68b4d2d410SLiu Zhe 		areaFillType.select(1);
69*c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Color", areaFillType.getSelText(), areaFillType.getItemText(1));
70b4d2d410SLiu Zhe 		areaFillColor.select(2);
7122a14f28SLiu Zhe 		// Area_Fill_Color.getItemCount();
72*c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Color is not the second item", areaFillColor.getSelText(), areaFillColor.getItemText(2));
73b4d2d410SLiu Zhe 		areaAreapage.ok();
7459f3c9b1SLiu Zhe 
7559f3c9b1SLiu Zhe 		// open Table Properties Dialog
7659f3c9b1SLiu Zhe 		app.dispatch(".uno:TableDialog", 3);
77b4d2d410SLiu Zhe 		areaAreapage.select();
7859f3c9b1SLiu Zhe 		// select Gradient
79b4d2d410SLiu Zhe 		areaFillType.select(2);
80*c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Gradient", areaFillType.getSelText(), areaFillType.getItemText(2));
81b4d2d410SLiu Zhe 		areaFillGradient.select(2);
82*c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Gradient is not the second item", areaFillGradient.getSelText(), areaFillGradient.getItemText(2));
83b4d2d410SLiu Zhe 		areaAreapage.ok();
8459f3c9b1SLiu Zhe 
8559f3c9b1SLiu Zhe 		// open Table Properties Dialog
8659f3c9b1SLiu Zhe 		app.dispatch(".uno:TableDialog", 3);
87b4d2d410SLiu Zhe 		areaAreapage.select();
8859f3c9b1SLiu Zhe 		// select Hatching
89b4d2d410SLiu Zhe 		areaFillType.select(3);
90*c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Hatching", areaFillType.getSelText(), areaFillType.getItemText(3));
91b4d2d410SLiu Zhe 		areaFillHatching.select(2);
92*c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Hatching is not the second item", areaFillHatching.getSelText(), areaFillHatching.getItemText(2));
93b4d2d410SLiu Zhe 		areaAreapage.ok();
9422a14f28SLiu Zhe 
9559f3c9b1SLiu Zhe 		// open Table Properties Dialog
9659f3c9b1SLiu Zhe 		app.dispatch(".uno:TableDialog", 3);
97b4d2d410SLiu Zhe 		areaAreapage.select();
9859f3c9b1SLiu Zhe 		// select Bitmap
99b4d2d410SLiu Zhe 		areaFillType.select(4);
100*c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Bitmap", areaFillType.getSelText(), areaFillType.getItemText(4));
101b4d2d410SLiu Zhe 		areaFillBitmap.select(2);
102*c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Bitmap is not the second item", areaFillBitmap.getSelText(), areaFillBitmap.getItemText(2));
103b4d2d410SLiu Zhe 		areaAreapage.ok();
10459f3c9b1SLiu Zhe 
10559f3c9b1SLiu Zhe 	}
10659f3c9b1SLiu Zhe 
10759f3c9b1SLiu Zhe }
108