xref: /AOO41X/test/testgui/source/fvt/gui/sd/table/TableBorderProperty.java (revision fd3484265709667881cfaec27d41da15d46b6832)
1c37bcbf4SLi Feng Wang /**************************************************************
2c37bcbf4SLi Feng Wang  *
3c37bcbf4SLi Feng Wang  * Licensed to the Apache Software Foundation (ASF) under one
4c37bcbf4SLi Feng Wang  * or more contributor license agreements.  See the NOTICE file
5c37bcbf4SLi Feng Wang  * distributed with this work for additional information
6c37bcbf4SLi Feng Wang  * regarding copyright ownership.  The ASF licenses this file
7c37bcbf4SLi Feng Wang  * to you under the Apache License, Version 2.0 (the
8c37bcbf4SLi Feng Wang  * "License"); you may not use this file except in compliance
9c37bcbf4SLi Feng Wang  * with the License.  You may obtain a copy of the License at
10c37bcbf4SLi Feng Wang  *
11c37bcbf4SLi Feng Wang  *   http://www.apache.org/licenses/LICENSE-2.0
12c37bcbf4SLi Feng Wang  *
13c37bcbf4SLi Feng Wang  * Unless required by applicable law or agreed to in writing,
14c37bcbf4SLi Feng Wang  * software distributed under the License is distributed on an
15c37bcbf4SLi Feng Wang  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c37bcbf4SLi Feng Wang  * KIND, either express or implied.  See the License for the
17c37bcbf4SLi Feng Wang  * specific language governing permissions and limitations
18c37bcbf4SLi Feng Wang  * under the License.
19c37bcbf4SLi Feng Wang  *
20c37bcbf4SLi Feng Wang  *************************************************************/
21c37bcbf4SLi Feng Wang 
22c37bcbf4SLi Feng Wang package fvt.gui.sd.table;
23c37bcbf4SLi Feng Wang 
24c37bcbf4SLi Feng Wang import static org.junit.Assert.*;
25c37bcbf4SLi Feng Wang import static org.openoffice.test.vcl.Tester.*;
26c37bcbf4SLi Feng Wang import static testlib.gui.UIMap.*;
27c37bcbf4SLi Feng Wang 
28c37bcbf4SLi Feng Wang import org.junit.After;
29c37bcbf4SLi Feng Wang import org.junit.Before;
30c37bcbf4SLi Feng Wang import org.junit.Rule;
31c37bcbf4SLi Feng Wang import org.junit.Test;
32c37bcbf4SLi Feng Wang import org.openoffice.test.common.Logger;
33c37bcbf4SLi Feng Wang 
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);
39c37bcbf4SLi Feng Wang 
40c37bcbf4SLi Feng Wang 	@Before
setUp()41c37bcbf4SLi Feng Wang 	public void setUp() throws Exception {
42c37bcbf4SLi Feng Wang 		app.start();
43c37bcbf4SLi Feng Wang 	}
44c37bcbf4SLi Feng Wang 
45c37bcbf4SLi Feng Wang 	@After
tearDown()46c37bcbf4SLi Feng Wang 	public void tearDown() throws Exception {
47c37bcbf4SLi Feng Wang 		app.stop();
48c37bcbf4SLi Feng Wang 	}
49c37bcbf4SLi Feng Wang 
50c37bcbf4SLi Feng Wang 	/**
51c37bcbf4SLi Feng Wang 	 * Test the table border property in Presentation
52c37bcbf4SLi Feng Wang 	 *
53c37bcbf4SLi Feng Wang 	 * @throws Exception
54c37bcbf4SLi Feng Wang 	 */
55c37bcbf4SLi Feng Wang 
56c37bcbf4SLi Feng Wang 	@Test
testTableBorderPropertyDialog()57c37bcbf4SLi Feng Wang 	public void testTableBorderPropertyDialog() throws Exception {
58c37bcbf4SLi Feng Wang 
59c37bcbf4SLi Feng Wang 		// Create a new presentation document
60c37bcbf4SLi Feng Wang 		AppTool.newPresentation();
61c37bcbf4SLi Feng Wang 
62c37bcbf4SLi Feng Wang 		// Insert a table
63c37bcbf4SLi Feng Wang 		app.dispatch(".uno:InsertTable", 3);
64c37bcbf4SLi Feng Wang 		insertTable.ok();
65c37bcbf4SLi Feng Wang 		sleep(3);
66c37bcbf4SLi Feng Wang 
67c37bcbf4SLi Feng Wang 		// Verify if the table toolbar is active
68c37bcbf4SLi Feng Wang 		assertTrue(tableToolbar.exists(3));
69c37bcbf4SLi Feng Wang 
70c37bcbf4SLi Feng Wang 		// open Table Properties Dialog
71c37bcbf4SLi Feng Wang 		app.dispatch(".uno:TableDialog", 3);
72c37bcbf4SLi Feng Wang 		areaBorderpage.select();
73c37bcbf4SLi Feng Wang 
74c37bcbf4SLi Feng Wang 		areaBorderPresets.click(0.01, 0.01);
75c37bcbf4SLi Feng Wang 
76c37bcbf4SLi Feng Wang 		// select Line
77c37bcbf4SLi Feng Wang 		areaBorderLineStyle.select(1);
78c37bcbf4SLi Feng Wang 		assertEquals("Area_Border_LineStyle is not the first item", areaBorderLineStyle.getSelText(), areaBorderLineStyle.getItemText(1));
79c37bcbf4SLi Feng Wang 
80c37bcbf4SLi Feng Wang 		areaBorderLineColor.select(1);
81c37bcbf4SLi Feng Wang 		assertEquals("Area_Border_LineColor is not the first item", areaBorderLineColor.getSelText(), areaBorderLineColor.getItemText(1));
82c37bcbf4SLi Feng Wang 
83c37bcbf4SLi Feng Wang 		// select Spacing to Contents
84c37bcbf4SLi Feng Wang 		areaBorderSync.check();
85c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Sync isn't checked", areaBorderSync.isChecked());
86c37bcbf4SLi Feng Wang 
87c37bcbf4SLi Feng Wang 		areaBorderMfLeft.setText("0.5");
88c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Mf_Left isn't 0.5", areaBorderMfLeft.getText().startsWith("0.5"));
89c37bcbf4SLi Feng Wang 
90c37bcbf4SLi Feng Wang 		areaBorderMfRight.setText("0.5");
91c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Mf_Right isn't 0.5", areaBorderMfRight.getText().startsWith("0.5"));
92c37bcbf4SLi Feng Wang 
93c37bcbf4SLi Feng Wang 		areaBorderMfTop.setText("0.5");
94c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Mf_Top isn't 0.5", areaBorderMfTop.getText().startsWith("0.5"));
95c37bcbf4SLi Feng Wang 
96c37bcbf4SLi Feng Wang 		areaBorderMfBottom.setText("0.5");
97c37bcbf4SLi Feng Wang 		assertTrue("Area_Border_Mf_Bottom isn't 0.5", areaBorderMfBottom.getText().startsWith("0.5"));
98c37bcbf4SLi Feng Wang 
99c37bcbf4SLi Feng Wang 		areaBorderpage.ok();
100c37bcbf4SLi Feng Wang 
101c37bcbf4SLi Feng Wang 	}
102c37bcbf4SLi Feng Wang }
103