xref: /trunk/test/testgui/source/fvt/gui/sc/validity/ValiditySampleFile.java (revision 80a6f5c575dba650469ea4eacf1c8652e4eec583)
1*80a6f5c5SLiu Zhe /**************************************************************
2*80a6f5c5SLiu Zhe  *
3*80a6f5c5SLiu Zhe  * Licensed to the Apache Software Foundation (ASF) under one
4*80a6f5c5SLiu Zhe  * or more contributor license agreements.  See the NOTICE file
5*80a6f5c5SLiu Zhe  * distributed with this work for additional information
6*80a6f5c5SLiu Zhe  * regarding copyright ownership.  The ASF licenses this file
7*80a6f5c5SLiu Zhe  * to you under the Apache License, Version 2.0 (the
8*80a6f5c5SLiu Zhe  * "License"); you may not use this file except in compliance
9*80a6f5c5SLiu Zhe  * with the License.  You may obtain a copy of the License at
10*80a6f5c5SLiu Zhe  *
11*80a6f5c5SLiu Zhe  *   http://www.apache.org/licenses/LICENSE-2.0
12*80a6f5c5SLiu Zhe  *
13*80a6f5c5SLiu Zhe  * Unless required by applicable law or agreed to in writing,
14*80a6f5c5SLiu Zhe  * software distributed under the License is distributed on an
15*80a6f5c5SLiu Zhe  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*80a6f5c5SLiu Zhe  * KIND, either express or implied.  See the License for the
17*80a6f5c5SLiu Zhe  * specific language governing permissions and limitations
18*80a6f5c5SLiu Zhe  * under the License.
19*80a6f5c5SLiu Zhe  *
20*80a6f5c5SLiu Zhe  *************************************************************/
21*80a6f5c5SLiu Zhe 
22*80a6f5c5SLiu Zhe package fvt.gui.sc.validity;
23*80a6f5c5SLiu Zhe 
24*80a6f5c5SLiu Zhe import static org.junit.Assert.*;
25*80a6f5c5SLiu Zhe import static org.openoffice.test.common.Testspace.*;
26*80a6f5c5SLiu Zhe import static testlib.gui.AppTool.*;
27*80a6f5c5SLiu Zhe import static testlib.gui.UIMap.*;
28*80a6f5c5SLiu Zhe 
29*80a6f5c5SLiu Zhe import org.junit.After;
30*80a6f5c5SLiu Zhe import org.junit.Before;
31*80a6f5c5SLiu Zhe import org.junit.Rule;
32*80a6f5c5SLiu Zhe import org.junit.Test;
33*80a6f5c5SLiu Zhe import org.openoffice.test.common.Logger;
34*80a6f5c5SLiu Zhe 
35*80a6f5c5SLiu Zhe import testlib.gui.SCTool;
36*80a6f5c5SLiu Zhe 
37*80a6f5c5SLiu Zhe public class ValiditySampleFile {
38*80a6f5c5SLiu Zhe 
39*80a6f5c5SLiu Zhe     @Rule
40*80a6f5c5SLiu Zhe     public Logger log = Logger.getLogger(this);
41*80a6f5c5SLiu Zhe 
42*80a6f5c5SLiu Zhe     @Before
43*80a6f5c5SLiu Zhe     public void setUp() throws Exception {
44*80a6f5c5SLiu Zhe         app.start(true);
45*80a6f5c5SLiu Zhe     }
46*80a6f5c5SLiu Zhe 
47*80a6f5c5SLiu Zhe     @After
48*80a6f5c5SLiu Zhe     public void tearDown() throws Exception {
49*80a6f5c5SLiu Zhe 
50*80a6f5c5SLiu Zhe     }
51*80a6f5c5SLiu Zhe 
52*80a6f5c5SLiu Zhe     /**
53*80a6f5c5SLiu Zhe      * Test open MS 2003 spreadsheet with ignore blank validity.
54*80a6f5c5SLiu Zhe      *
55*80a6f5c5SLiu Zhe      * @throws Exception
56*80a6f5c5SLiu Zhe      */
57*80a6f5c5SLiu Zhe     @Test
58*80a6f5c5SLiu Zhe     public void testFFCIgnoreBlank() throws Exception {
59*80a6f5c5SLiu Zhe         // Open sample file
60*80a6f5c5SLiu Zhe         String file = prepareData("sc/FFC252FFCSC_XML_Datarange0235.xls");
61*80a6f5c5SLiu Zhe         app.dispatch(".uno:Open", 3);
62*80a6f5c5SLiu Zhe         submitOpenDlg(file);
63*80a6f5c5SLiu Zhe         calc.waitForExistence(10, 2);
64*80a6f5c5SLiu Zhe 
65*80a6f5c5SLiu Zhe         SCTool.selectRange("D5");
66*80a6f5c5SLiu Zhe         scInputBarInput.activate();
67*80a6f5c5SLiu Zhe         for (int i = 1; i <= 10; i++)
68*80a6f5c5SLiu Zhe             typeKeys("<backspace>");
69*80a6f5c5SLiu Zhe         typeKeys("<enter>");
70*80a6f5c5SLiu Zhe 
71*80a6f5c5SLiu Zhe         assertEquals("", SCTool.getCellText("D5"));
72*80a6f5c5SLiu Zhe     }
73*80a6f5c5SLiu Zhe 
74*80a6f5c5SLiu Zhe     /**
75*80a6f5c5SLiu Zhe      * Test open MS 2003 spreadsheet with ignore blank validity.
76*80a6f5c5SLiu Zhe      *
77*80a6f5c5SLiu Zhe      * @throws Exception
78*80a6f5c5SLiu Zhe      */
79*80a6f5c5SLiu Zhe     @Test
80*80a6f5c5SLiu Zhe     public void testFFCNotIgnoreBlank() throws Exception {
81*80a6f5c5SLiu Zhe         // open sample file
82*80a6f5c5SLiu Zhe         String file = prepareData("sc/FFC252FFCSC_XML_Datarange0205.xls");
83*80a6f5c5SLiu Zhe         app.dispatch(".uno:Open", 3);
84*80a6f5c5SLiu Zhe         submitOpenDlg(file);
85*80a6f5c5SLiu Zhe         calc.waitForExistence(10, 2);
86*80a6f5c5SLiu Zhe 
87*80a6f5c5SLiu Zhe         SCTool.selectRange("F5");
88*80a6f5c5SLiu Zhe         scInputBarInput.activate();
89*80a6f5c5SLiu Zhe         typeKeys("<backspace><enter>");
90*80a6f5c5SLiu Zhe 
91*80a6f5c5SLiu Zhe         activeMsgBox.ok();
92*80a6f5c5SLiu Zhe         assertEquals("8", SCTool.getCellText("F5"));
93*80a6f5c5SLiu Zhe     }
94*80a6f5c5SLiu Zhe 
95*80a6f5c5SLiu Zhe     /**
96*80a6f5c5SLiu Zhe      * test Cell is not locked after switch from validity cell to source cells
97*80a6f5c5SLiu Zhe      */
98*80a6f5c5SLiu Zhe     @Test
99*80a6f5c5SLiu Zhe     public void testNotLockCellFromValidityCell() {
100*80a6f5c5SLiu Zhe         // open sample file on data path
101*80a6f5c5SLiu Zhe         String file = prepareData("sc/sampledata.ods");
102*80a6f5c5SLiu Zhe         app.dispatch(".uno:Open", 3);
103*80a6f5c5SLiu Zhe         submitOpenDlg(file);
104*80a6f5c5SLiu Zhe         calc.waitForExistence(10, 2);
105*80a6f5c5SLiu Zhe 
106*80a6f5c5SLiu Zhe         SCTool.selectRange("F19");
107*80a6f5c5SLiu Zhe         typeKeys("d<enter>");
108*80a6f5c5SLiu Zhe         SCTool.selectRange("F17");
109*80a6f5c5SLiu Zhe         typeKeys("Test<enter>");
110*80a6f5c5SLiu Zhe 
111*80a6f5c5SLiu Zhe         assertEquals("Test", SCTool.getCellText("F17"));
112*80a6f5c5SLiu Zhe     }
113*80a6f5c5SLiu Zhe }
114