xref: /trunk/test/testgui/source/fvt/gui/sc/validity/ValiditySampleFile.java (revision 424494b095bc90dc2fe31bd4233af124f1760355)
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.sc.validity;
23 
24 import static org.junit.Assert.*;
25 import static org.openoffice.test.common.Testspace.*;
26 import static testlib.gui.AppTool.*;
27 import static testlib.gui.UIMap.*;
28 
29 import org.junit.After;
30 import org.junit.Before;
31 import org.junit.Rule;
32 import org.junit.Test;
33 import org.openoffice.test.common.Logger;
34 
35 import testlib.gui.SCTool;
36 
37 public class ValiditySampleFile {
38 
39     @Before
40     public void setUp() throws Exception {
41         app.start(true);
42     }
43 
44     @After
45     public void tearDown() throws Exception {
46         app.stop();
47 
48     }
49 
50     /**
51      * Test open MS 2003 spreadsheet with ignore blank validity.
52      *
53      * @throws Exception
54      */
55     @Test
56     public void testFFCIgnoreBlank() throws Exception {
57         // Open sample file
58         String file = prepareData("sc/FFC252FFCSC_XML_Datarange0235.xls");
59         open(file);
60         calc.waitForExistence(10, 2);
61 
62         SCTool.selectRange("D5");
63         scInputBarInput.activate();
64         for (int i = 1; i <= 10; i++)
65             typeKeys("<backspace>");
66         typeKeys("<enter>");
67 
68         assertEquals("", SCTool.getCellText("D5"));
69     }
70 
71     /**
72      * Test open MS 2003 spreadsheet with ignore blank validity.
73      *
74      * @throws Exception
75      */
76     @Test
77     public void testFFCNotIgnoreBlank() throws Exception {
78         // open sample file
79         String file = prepareData("sc/FFC252FFCSC_XML_Datarange0205.xls");
80         open(file);
81         calc.waitForExistence(10, 2);
82 
83         SCTool.selectRange("F5");
84         scInputBarInput.activate();
85         typeKeys("<backspace><enter>");
86 
87         activeMsgBox.ok();
88         assertEquals("8", SCTool.getCellText("F5"));
89     }
90 
91     /**
92      * test Cell is not locked after switch from validity cell to source cells
93      */
94     @Test
95     public void testNotLockCellFromValidityCell() {
96         // open sample file on data path
97         String file = prepareData("sc/sampledata.ods");
98         open(file);
99         calc.waitForExistence(10, 2);
100 
101         SCTool.selectRange("F19");
102         typeKeys("d<enter>");
103         SCTool.selectRange("F17");
104         typeKeys("Test<enter>");
105 
106         assertEquals("Test", SCTool.getCellText("F17"));
107     }
108 }
109