xref: /trunk/test/testgui/source/fvt/gui/sc/validity/ValidityDateSupport1024Columns.java (revision 3309286857f19787ae62bd793a98b5af4edd2ad3)
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 testlib.gui.AppTool.*;
2680a6f5c5SLiu Zhe import static testlib.gui.UIMap.*;
2780a6f5c5SLiu Zhe 
2880a6f5c5SLiu Zhe import org.junit.After;
2980a6f5c5SLiu Zhe import org.junit.Before;
3080a6f5c5SLiu Zhe import org.junit.Rule;
3180a6f5c5SLiu Zhe import org.junit.Test;
3280a6f5c5SLiu Zhe import org.openoffice.test.common.Logger;
3380a6f5c5SLiu Zhe 
34424494b0SLi Feng Wang import testlib.gui.AppTool;
3580a6f5c5SLiu Zhe import testlib.gui.SCTool;
3680a6f5c5SLiu Zhe 
3780a6f5c5SLiu Zhe public class ValidityDateSupport1024Columns {
3880a6f5c5SLiu Zhe 
39*fd348426SLi Feng Wang     @Rule
40*fd348426SLi Feng Wang     public Logger log = Logger.getLogger(this);
4180a6f5c5SLiu Zhe 
4280a6f5c5SLiu Zhe     @Before
setUp()4380a6f5c5SLiu Zhe     public void setUp() throws Exception {
4480a6f5c5SLiu Zhe         app.start(true);
45424494b0SLi Feng Wang         AppTool.newSpreadsheet();
4680a6f5c5SLiu Zhe     }
4780a6f5c5SLiu Zhe 
4880a6f5c5SLiu Zhe     @After
tearDown()4980a6f5c5SLiu Zhe     public void tearDown() throws Exception {
50424494b0SLi Feng Wang         app.stop();
5180a6f5c5SLiu Zhe     }
5280a6f5c5SLiu Zhe 
5380a6f5c5SLiu Zhe     /**
5480a6f5c5SLiu Zhe      * test Allow Greater than or equal to Date type in Validity, support 1024
5580a6f5c5SLiu Zhe      * columns.
5680a6f5c5SLiu Zhe      */
5780a6f5c5SLiu Zhe     @Test
testValidityDateSupport1024Columns()5880a6f5c5SLiu Zhe     public void testValidityDateSupport1024Columns() {
5980a6f5c5SLiu Zhe         SCTool.selectRange("ALM1000:ALO1005");
6080a6f5c5SLiu Zhe         app.dispatch(".uno:Validation");
6180a6f5c5SLiu Zhe 
6280a6f5c5SLiu Zhe         scValidityCriteriaTabpage.select();
6380a6f5c5SLiu Zhe         scValidityCriteriaAllowList.select(3); // "Date"
6480a6f5c5SLiu Zhe         scValidityDecimalCompareOperator.select(2); // "greater than"
6580a6f5c5SLiu Zhe         scValiditySourceInput.setText("01/01/08");
6680a6f5c5SLiu Zhe         scValidityErrorAlertTabPage.select();
6780a6f5c5SLiu Zhe         scValidityShowErrorMessage.check();
6880a6f5c5SLiu Zhe         scValidityErrorMessageTitle.setText("Stop to enter");
6980a6f5c5SLiu Zhe         scValidityErrorMessage.setText("Invalid value");
7080a6f5c5SLiu Zhe         scValidityErrorAlertTabPage.ok();
7180a6f5c5SLiu Zhe 
7280a6f5c5SLiu Zhe         SCTool.selectRange("ALM1001");
7380a6f5c5SLiu Zhe         scInputBarInput.activate();
7480a6f5c5SLiu Zhe         typeKeys("02/01/08<enter>");
75424494b0SLi Feng Wang         assertEquals("Cell text in ALM1001 is not 02/01/08","02/01/08", SCTool.getCellText("ALM1001"));
7680a6f5c5SLiu Zhe 
7780a6f5c5SLiu Zhe         SCTool.selectRange("ALM1002");
7880a6f5c5SLiu Zhe         scInputBarInput.activate();
7980a6f5c5SLiu Zhe         typeKeys("01/02/08<enter>");
80424494b0SLi Feng Wang         assertEquals("Cell text in ALM1002 is not 01/02/08","01/02/08", SCTool.getCellText("ALM1002"));
8180a6f5c5SLiu Zhe 
8280a6f5c5SLiu Zhe         SCTool.selectRange("ALM1003");
8380a6f5c5SLiu Zhe         scInputBarInput.activate();
8480a6f5c5SLiu Zhe         typeKeys("01/01/08<enter>");
85424494b0SLi Feng Wang         assertEquals("Have no alert message","Invalid value", activeMsgBox.getMessage());
8657caf934SLiu Zhe         activeMsgBox.ok();
87424494b0SLi Feng Wang         assertEquals("Validity have not filter invalid value","", SCTool.getCellText("ALM1003"));
8880a6f5c5SLiu Zhe 
8980a6f5c5SLiu Zhe         SCTool.selectRange("AML1003");
9080a6f5c5SLiu Zhe         scInputBarInput.activate();
9180a6f5c5SLiu Zhe         typeKeys("12/31/07<enter>");
92424494b0SLi Feng Wang         assertEquals("Have no alert message","Invalid value", activeMsgBox.getMessage());
9357caf934SLiu Zhe         activeMsgBox.ok();
94424494b0SLi Feng Wang         assertEquals("Validity have not filter invalid value","", SCTool.getCellText("AML1003"));
9580a6f5c5SLiu Zhe     }
9680a6f5c5SLiu Zhe }
97