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 org.openoffice.test.vcl.Tester.*;
26 import static testlib.gui.UIMap.*;
27 
28 import org.junit.After;
29 import org.junit.Before;
30 import org.junit.Rule;
31 import org.junit.Test;
32 import org.openoffice.test.common.Logger;
33 
34 import testlib.gui.AppTool;
35 
36 public class TableBorderProperty {
37 	@Rule
38 	public Logger log = Logger.getLogger(this);
39 
40 	@Before
setUp()41 	public void setUp() throws Exception {
42 		app.start();
43 	}
44 
45 	@After
tearDown()46 	public void tearDown() throws Exception {
47 		app.stop();
48 	}
49 
50 	/**
51 	 * Test the table border property in Presentation
52 	 *
53 	 * @throws Exception
54 	 */
55 
56 	@Test
testTableBorderPropertyDialog()57 	public void testTableBorderPropertyDialog() throws Exception {
58 
59 		// Create a new presentation document
60 		AppTool.newPresentation();
61 
62 		// Insert a table
63 		app.dispatch(".uno:InsertTable", 3);
64 		insertTable.ok();
65 		sleep(3);
66 
67 		// Verify if the table toolbar is active
68 		assertTrue(tableToolbar.exists(3));
69 
70 		// open Table Properties Dialog
71 		app.dispatch(".uno:TableDialog", 3);
72 		areaBorderpage.select();
73 
74 		areaBorderPresets.click(0.01, 0.01);
75 
76 		// select Line
77 		areaBorderLineStyle.select(1);
78 		assertEquals("Area_Border_LineStyle is not the first item", areaBorderLineStyle.getSelText(), areaBorderLineStyle.getItemText(1));
79 
80 		areaBorderLineColor.select(1);
81 		assertEquals("Area_Border_LineColor is not the first item", areaBorderLineColor.getSelText(), areaBorderLineColor.getItemText(1));
82 
83 		// select Spacing to Contents
84 		areaBorderSync.check();
85 		assertTrue("Area_Border_Sync isn't checked", areaBorderSync.isChecked());
86 
87 		areaBorderMfLeft.setText("0.5");
88 		assertTrue("Area_Border_Mf_Left isn't 0.5", areaBorderMfLeft.getText().startsWith("0.5"));
89 
90 		areaBorderMfRight.setText("0.5");
91 		assertTrue("Area_Border_Mf_Right isn't 0.5", areaBorderMfRight.getText().startsWith("0.5"));
92 
93 		areaBorderMfTop.setText("0.5");
94 		assertTrue("Area_Border_Mf_Top isn't 0.5", areaBorderMfTop.getText().startsWith("0.5"));
95 
96 		areaBorderMfBottom.setText("0.5");
97 		assertTrue("Area_Border_Mf_Bottom isn't 0.5", areaBorderMfBottom.getText().startsWith("0.5"));
98 
99 		areaBorderpage.ok();
100 
101 	}
102 }
103