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