xref: /trunk/test/testgui/source/fvt/gui/sc/validity/ValiditySampleFile.java (revision fd3484265709667881cfaec27d41da15d46b6832)
180a6f5c5SLiu Zhe /**************************************************************
280a6f5c5SLiu Zhe  *
380a6f5c5SLiu Zhe  * Licensed to the Apache Software Foundation (ASF) under one
480a6f5c5SLiu Zhe  * or more contributor license agreements.  See the NOTICE file
580a6f5c5SLiu Zhe  * distributed with this work for additional information
680a6f5c5SLiu Zhe  * regarding copyright ownership.  The ASF licenses this file
780a6f5c5SLiu Zhe  * to you under the Apache License, Version 2.0 (the
880a6f5c5SLiu Zhe  * "License"); you may not use this file except in compliance
980a6f5c5SLiu Zhe  * with the License.  You may obtain a copy of the License at
1080a6f5c5SLiu Zhe  *
1180a6f5c5SLiu Zhe  *   http://www.apache.org/licenses/LICENSE-2.0
1280a6f5c5SLiu Zhe  *
1380a6f5c5SLiu Zhe  * Unless required by applicable law or agreed to in writing,
1480a6f5c5SLiu Zhe  * software distributed under the License is distributed on an
1580a6f5c5SLiu Zhe  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1680a6f5c5SLiu Zhe  * KIND, either express or implied.  See the License for the
1780a6f5c5SLiu Zhe  * specific language governing permissions and limitations
1880a6f5c5SLiu Zhe  * under the License.
1980a6f5c5SLiu Zhe  *
2080a6f5c5SLiu Zhe  *************************************************************/
2180a6f5c5SLiu Zhe 
2280a6f5c5SLiu Zhe package fvt.gui.sc.validity;
2380a6f5c5SLiu Zhe 
2480a6f5c5SLiu Zhe import static org.junit.Assert.*;
2580a6f5c5SLiu Zhe import static org.openoffice.test.common.Testspace.*;
2680a6f5c5SLiu Zhe import static testlib.gui.AppTool.*;
2780a6f5c5SLiu Zhe import static testlib.gui.UIMap.*;
2880a6f5c5SLiu Zhe 
2980a6f5c5SLiu Zhe import org.junit.After;
3080a6f5c5SLiu Zhe import org.junit.Before;
3180a6f5c5SLiu Zhe import org.junit.Rule;
3280a6f5c5SLiu Zhe import org.junit.Test;
3380a6f5c5SLiu Zhe import org.openoffice.test.common.Logger;
3480a6f5c5SLiu Zhe 
3580a6f5c5SLiu Zhe import testlib.gui.SCTool;
3680a6f5c5SLiu Zhe 
3780a6f5c5SLiu Zhe public class ValiditySampleFile {
3880a6f5c5SLiu Zhe 
39*fd348426SLi Feng Wang     @Rule
40*fd348426SLi Feng Wang     public Logger log = Logger.getLogger(this);
41*fd348426SLi Feng Wang 
4280a6f5c5SLiu Zhe     @Before
4380a6f5c5SLiu Zhe     public void setUp() throws Exception {
4480a6f5c5SLiu Zhe         app.start(true);
4580a6f5c5SLiu Zhe     }
4680a6f5c5SLiu Zhe 
4780a6f5c5SLiu Zhe     @After
4880a6f5c5SLiu Zhe     public void tearDown() throws Exception {
49424494b0SLi Feng Wang         app.stop();
5080a6f5c5SLiu Zhe 
5180a6f5c5SLiu Zhe     }
5280a6f5c5SLiu Zhe 
5380a6f5c5SLiu Zhe     /**
5480a6f5c5SLiu Zhe      * Test open MS 2003 spreadsheet with ignore blank validity.
5580a6f5c5SLiu Zhe      *
5680a6f5c5SLiu Zhe      * @throws Exception
5780a6f5c5SLiu Zhe      */
5880a6f5c5SLiu Zhe     @Test
5980a6f5c5SLiu Zhe     public void testFFCIgnoreBlank() throws Exception {
6080a6f5c5SLiu Zhe         // Open sample file
6180a6f5c5SLiu Zhe         String file = prepareData("sc/FFC252FFCSC_XML_Datarange0235.xls");
62424494b0SLi Feng Wang         open(file);
6380a6f5c5SLiu Zhe         calc.waitForExistence(10, 2);
6480a6f5c5SLiu Zhe 
6580a6f5c5SLiu Zhe         SCTool.selectRange("D5");
6680a6f5c5SLiu Zhe         scInputBarInput.activate();
6780a6f5c5SLiu Zhe         for (int i = 1; i <= 10; i++)
6880a6f5c5SLiu Zhe             typeKeys("<backspace>");
6980a6f5c5SLiu Zhe         typeKeys("<enter>");
7080a6f5c5SLiu Zhe 
7180a6f5c5SLiu Zhe         assertEquals("", SCTool.getCellText("D5"));
7280a6f5c5SLiu Zhe     }
7380a6f5c5SLiu Zhe 
7480a6f5c5SLiu Zhe     /**
7580a6f5c5SLiu Zhe      * Test open MS 2003 spreadsheet with ignore blank validity.
7680a6f5c5SLiu Zhe      *
7780a6f5c5SLiu Zhe      * @throws Exception
7880a6f5c5SLiu Zhe      */
7980a6f5c5SLiu Zhe     @Test
8080a6f5c5SLiu Zhe     public void testFFCNotIgnoreBlank() throws Exception {
8180a6f5c5SLiu Zhe         // open sample file
8280a6f5c5SLiu Zhe         String file = prepareData("sc/FFC252FFCSC_XML_Datarange0205.xls");
83424494b0SLi Feng Wang         open(file);
8480a6f5c5SLiu Zhe         calc.waitForExistence(10, 2);
8580a6f5c5SLiu Zhe 
8680a6f5c5SLiu Zhe         SCTool.selectRange("F5");
8780a6f5c5SLiu Zhe         scInputBarInput.activate();
8880a6f5c5SLiu Zhe         typeKeys("<backspace><enter>");
8980a6f5c5SLiu Zhe 
9080a6f5c5SLiu Zhe         activeMsgBox.ok();
9180a6f5c5SLiu Zhe         assertEquals("8", SCTool.getCellText("F5"));
9280a6f5c5SLiu Zhe     }
9380a6f5c5SLiu Zhe 
9480a6f5c5SLiu Zhe     /**
9580a6f5c5SLiu Zhe      * test Cell is not locked after switch from validity cell to source cells
9680a6f5c5SLiu Zhe      */
9780a6f5c5SLiu Zhe     @Test
9880a6f5c5SLiu Zhe     public void testNotLockCellFromValidityCell() {
9980a6f5c5SLiu Zhe         // open sample file on data path
10080a6f5c5SLiu Zhe         String file = prepareData("sc/sampledata.ods");
101424494b0SLi Feng Wang         open(file);
10280a6f5c5SLiu Zhe         calc.waitForExistence(10, 2);
10380a6f5c5SLiu Zhe 
10480a6f5c5SLiu Zhe         SCTool.selectRange("F19");
10580a6f5c5SLiu Zhe         typeKeys("d<enter>");
10680a6f5c5SLiu Zhe         SCTool.selectRange("F17");
10780a6f5c5SLiu Zhe         typeKeys("Test<enter>");
10880a6f5c5SLiu Zhe 
10980a6f5c5SLiu Zhe         assertEquals("Test", SCTool.getCellText("F17"));
11080a6f5c5SLiu Zhe     }
11180a6f5c5SLiu Zhe }
112