177ad4a0eSLiu Zhe /**************************************************************
277ad4a0eSLiu Zhe  *
377ad4a0eSLiu Zhe  * Licensed to the Apache Software Foundation (ASF) under one
477ad4a0eSLiu Zhe  * or more contributor license agreements.  See the NOTICE file
577ad4a0eSLiu Zhe  * distributed with this work for additional information
677ad4a0eSLiu Zhe  * regarding copyright ownership.  The ASF licenses this file
777ad4a0eSLiu Zhe  * to you under the Apache License, Version 2.0 (the
877ad4a0eSLiu Zhe  * "License"); you may not use this file except in compliance
977ad4a0eSLiu Zhe  * with the License.  You may obtain a copy of the License at
1077ad4a0eSLiu Zhe  *
1177ad4a0eSLiu Zhe  *   http://www.apache.org/licenses/LICENSE-2.0
1277ad4a0eSLiu Zhe  *
1377ad4a0eSLiu Zhe  * Unless required by applicable law or agreed to in writing,
1477ad4a0eSLiu Zhe  * software distributed under the License is distributed on an
1577ad4a0eSLiu Zhe  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1677ad4a0eSLiu Zhe  * KIND, either express or implied.  See the License for the
1777ad4a0eSLiu Zhe  * specific language governing permissions and limitations
1877ad4a0eSLiu Zhe  * under the License.
1977ad4a0eSLiu Zhe  *
2077ad4a0eSLiu Zhe  *************************************************************/
2177ad4a0eSLiu Zhe 
2280a6f5c5SLiu Zhe package fvt.gui.sd.table;
2377ad4a0eSLiu Zhe 
2422a14f28SLiu Zhe import static org.junit.Assert.*;
2522a14f28SLiu Zhe import static org.openoffice.test.vcl.Tester.*;
2677ad4a0eSLiu Zhe import static testlib.gui.UIMap.*;
2777ad4a0eSLiu Zhe 
2877ad4a0eSLiu Zhe import org.junit.After;
2977ad4a0eSLiu Zhe import org.junit.Before;
3077ad4a0eSLiu Zhe import org.junit.Rule;
3177ad4a0eSLiu Zhe import org.junit.Test;
3222a14f28SLiu Zhe import org.openoffice.test.common.Logger;
3377ad4a0eSLiu Zhe 
34c37bcbf4SLi Feng Wang import testlib.gui.AppTool;
35c37bcbf4SLi Feng Wang 
36c37bcbf4SLi Feng Wang public class TableBorderProperty {
37*fd348426SLi Feng Wang 	@Rule
38*fd348426SLi Feng Wang 	public Logger log = Logger.getLogger(this);
3977ad4a0eSLiu Zhe 
4077ad4a0eSLiu Zhe 	@Before
setUp()4177ad4a0eSLiu Zhe 	public void setUp() throws Exception {
4277ad4a0eSLiu Zhe 		app.start();
4377ad4a0eSLiu Zhe 	}
4477ad4a0eSLiu Zhe 
4577ad4a0eSLiu Zhe 	@After
tearDown()4677ad4a0eSLiu Zhe 	public void tearDown() throws Exception {
47c37bcbf4SLi Feng Wang 		app.stop();
4877ad4a0eSLiu Zhe 	}
4977ad4a0eSLiu Zhe 
5077ad4a0eSLiu Zhe 	/**
51c37bcbf4SLi Feng Wang 	 * Test the table border property in Presentation
5277ad4a0eSLiu Zhe 	 *
5377ad4a0eSLiu Zhe 	 * @throws Exception
5477ad4a0eSLiu Zhe 	 */
5577ad4a0eSLiu Zhe 
5677ad4a0eSLiu Zhe 	@Test
testTableBorderPropertyDialog()57c37bcbf4SLi Feng Wang 	public void testTableBorderPropertyDialog() throws Exception {
5877ad4a0eSLiu Zhe 
5977ad4a0eSLiu Zhe 		// Create a new presentation document
60c37bcbf4SLi Feng Wang 		AppTool.newPresentation();
6177ad4a0eSLiu Zhe 
6277ad4a0eSLiu Zhe 		// Insert a table
6377ad4a0eSLiu Zhe 		app.dispatch(".uno:InsertTable", 3);
64b4d2d410SLiu Zhe 		insertTable.ok();
6577ad4a0eSLiu Zhe 		sleep(3);
6677ad4a0eSLiu Zhe 
6777ad4a0eSLiu Zhe 		// Verify if the table toolbar is active
68b4d2d410SLiu Zhe 		assertTrue(tableToolbar.exists(3));
6977ad4a0eSLiu Zhe 
7077ad4a0eSLiu Zhe 		// open Table Properties Dialog
7177ad4a0eSLiu Zhe 		app.dispatch(".uno:TableDialog", 3);
72b4d2d410SLiu Zhe 		areaBorderpage.select();
7322a14f28SLiu Zhe 
74b4d2d410SLiu Zhe 		areaBorderPresets.click(0.01, 0.01);
7522a14f28SLiu Zhe 
7677ad4a0eSLiu Zhe 		// select Line
77b4d2d410SLiu Zhe 		areaBorderLineStyle.select(1);
78c37bcbf4SLi Feng Wang 		assertEquals("Area_Border_LineStyle is not the first item", areaBorderLineStyle.getSelText(), areaBorderLineStyle.getItemText(1));
7922a14f28SLiu Zhe 
80b4d2d410SLiu Zhe 		areaBorderLineColor.select(1);
81c37bcbf4SLi Feng Wang 		assertEquals("Area_Border_LineColor is not the first item", areaBorderLineColor.getSelText(), areaBorderLineColor.getItemText(1));
8222a14f28SLiu Zhe 
8377ad4a0eSLiu Zhe 		// select Spacing to Contents
84b4d2d410SLiu Zhe 		areaBorderSync.check();
85c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Sync isn't checked", areaBorderSync.isChecked());
8622a14f28SLiu Zhe 
87b4d2d410SLiu Zhe 		areaBorderMfLeft.setText("0.5");
88c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Mf_Left isn't 0.5", areaBorderMfLeft.getText().startsWith("0.5"));
8922a14f28SLiu Zhe 
90b4d2d410SLiu Zhe 		areaBorderMfRight.setText("0.5");
91c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Mf_Right isn't 0.5", areaBorderMfRight.getText().startsWith("0.5"));
9222a14f28SLiu Zhe 
93b4d2d410SLiu Zhe 		areaBorderMfTop.setText("0.5");
94c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Mf_Top isn't 0.5", areaBorderMfTop.getText().startsWith("0.5"));
9522a14f28SLiu Zhe 
96b4d2d410SLiu Zhe 		areaBorderMfBottom.setText("0.5");
97c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Mf_Bottom isn't 0.5", areaBorderMfBottom.getText().startsWith("0.5"));
9822a14f28SLiu Zhe 
99b4d2d410SLiu Zhe 		areaBorderpage.ok();
10022a14f28SLiu Zhe 
10177ad4a0eSLiu Zhe 	}
10277ad4a0eSLiu Zhe }
103