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 
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);
3859f3c9b1SLiu Zhe 
3959f3c9b1SLiu Zhe 	@Before
setUp()4059f3c9b1SLiu Zhe 	public void setUp() throws Exception {
4159f3c9b1SLiu Zhe 		app.start();
4259f3c9b1SLiu Zhe 	}
4359f3c9b1SLiu Zhe 
4459f3c9b1SLiu Zhe 	@After
tearDown()4559f3c9b1SLiu Zhe 	public void tearDown() throws Exception {
46c37bcbf4SLi Feng Wang 		app.stop();
4759f3c9b1SLiu Zhe 	}
4859f3c9b1SLiu Zhe 
4959f3c9b1SLiu Zhe 	/**
50c37bcbf4SLi Feng Wang 	 * Test the Table Background property dialog in Presentation
5159f3c9b1SLiu Zhe 	 *
5259f3c9b1SLiu Zhe 	 * @throws Exception
5359f3c9b1SLiu Zhe 	 */
5459f3c9b1SLiu Zhe 
5559f3c9b1SLiu Zhe 	@Test
testTableBackgroundPropertyDialog()56c37bcbf4SLi Feng Wang 	public void testTableBackgroundPropertyDialog() throws Exception {
57c37bcbf4SLi Feng Wang 		AppTool.newPresentation();
5859f3c9b1SLiu Zhe 
5959f3c9b1SLiu Zhe 		// Insert a table
6059f3c9b1SLiu Zhe 		app.dispatch(".uno:InsertTable", 3);
61b4d2d410SLiu Zhe 		insertTable.ok();
6259f3c9b1SLiu Zhe 
6359f3c9b1SLiu Zhe 		// Verify if the table toolbar is active
64b4d2d410SLiu Zhe 		assertTrue(tableToolbar.exists(3));
6559f3c9b1SLiu Zhe 
6659f3c9b1SLiu Zhe 		// open Table Properties Dialog
6759f3c9b1SLiu Zhe 		app.dispatch(".uno:TableDialog", 3);
68b4d2d410SLiu Zhe 		areaAreapage.select();
6959f3c9b1SLiu Zhe 		// select Color
70b4d2d410SLiu Zhe 		areaFillType.select(1);
71c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Color", areaFillType.getSelText(), areaFillType.getItemText(1));
72b4d2d410SLiu Zhe 		areaFillColor.select(2);
7322a14f28SLiu Zhe 		// Area_Fill_Color.getItemCount();
74c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Color is not the second item", areaFillColor.getSelText(), areaFillColor.getItemText(2));
75b4d2d410SLiu Zhe 		areaAreapage.ok();
7659f3c9b1SLiu Zhe 
7759f3c9b1SLiu Zhe 		// open Table Properties Dialog
7859f3c9b1SLiu Zhe 		app.dispatch(".uno:TableDialog", 3);
79b4d2d410SLiu Zhe 		areaAreapage.select();
8059f3c9b1SLiu Zhe 		// select Gradient
81b4d2d410SLiu Zhe 		areaFillType.select(2);
82c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Gradient", areaFillType.getSelText(), areaFillType.getItemText(2));
83b4d2d410SLiu Zhe 		areaFillGradient.select(2);
84c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Gradient is not the second item", areaFillGradient.getSelText(), areaFillGradient.getItemText(2));
85b4d2d410SLiu Zhe 		areaAreapage.ok();
8659f3c9b1SLiu Zhe 
8759f3c9b1SLiu Zhe 		// open Table Properties Dialog
8859f3c9b1SLiu Zhe 		app.dispatch(".uno:TableDialog", 3);
89b4d2d410SLiu Zhe 		areaAreapage.select();
9059f3c9b1SLiu Zhe 		// select Hatching
91b4d2d410SLiu Zhe 		areaFillType.select(3);
92c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Hatching", areaFillType.getSelText(), areaFillType.getItemText(3));
93b4d2d410SLiu Zhe 		areaFillHatching.select(2);
94c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Hatching is not the second item", areaFillHatching.getSelText(), areaFillHatching.getItemText(2));
95b4d2d410SLiu Zhe 		areaAreapage.ok();
9622a14f28SLiu Zhe 
9759f3c9b1SLiu Zhe 		// open Table Properties Dialog
9859f3c9b1SLiu Zhe 		app.dispatch(".uno:TableDialog", 3);
99b4d2d410SLiu Zhe 		areaAreapage.select();
10059f3c9b1SLiu Zhe 		// select Bitmap
101b4d2d410SLiu Zhe 		areaFillType.select(4);
102c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Type is not Bitmap", areaFillType.getSelText(), areaFillType.getItemText(4));
103b4d2d410SLiu Zhe 		areaFillBitmap.select(2);
104c37bcbf4SLi Feng Wang 		assertEquals("Area_Fill_Bitmap is not the second item", areaFillBitmap.getSelText(), areaFillBitmap.getItemText(2));
105b4d2d410SLiu Zhe 		areaAreapage.ok();
10659f3c9b1SLiu Zhe 
10759f3c9b1SLiu Zhe 	}
10859f3c9b1SLiu Zhe 
10959f3c9b1SLiu Zhe }
110