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