xref: /AOO41X/test/testgui/source/fvt/gui/sc/validity/ValidityDateSupport1024Columns.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 testlib.gui.AppTool.*;
26 import static testlib.gui.UIMap.*;
27 
28 import org.junit.After;
29 import org.junit.Before;
30 import org.junit.Rule;
31 import org.junit.Test;
32 import org.openoffice.test.common.Logger;
33 
34 import testlib.gui.AppTool;
35 import testlib.gui.SCTool;
36 
37 public class ValidityDateSupport1024Columns {
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         AppTool.newSpreadsheet();
46     }
47 
48     @After
tearDown()49     public void tearDown() throws Exception {
50         app.stop();
51     }
52 
53     /**
54      * test Allow Greater than or equal to Date type in Validity, support 1024
55      * columns.
56      */
57     @Test
testValidityDateSupport1024Columns()58     public void testValidityDateSupport1024Columns() {
59         SCTool.selectRange("ALM1000:ALO1005");
60         app.dispatch(".uno:Validation");
61 
62         scValidityCriteriaTabpage.select();
63         scValidityCriteriaAllowList.select(3); // "Date"
64         scValidityDecimalCompareOperator.select(2); // "greater than"
65         scValiditySourceInput.setText("01/01/08");
66         scValidityErrorAlertTabPage.select();
67         scValidityShowErrorMessage.check();
68         scValidityErrorMessageTitle.setText("Stop to enter");
69         scValidityErrorMessage.setText("Invalid value");
70         scValidityErrorAlertTabPage.ok();
71 
72         SCTool.selectRange("ALM1001");
73         scInputBarInput.activate();
74         typeKeys("02/01/08<enter>");
75         assertEquals("Cell text in ALM1001 is not 02/01/08","02/01/08", SCTool.getCellText("ALM1001"));
76 
77         SCTool.selectRange("ALM1002");
78         scInputBarInput.activate();
79         typeKeys("01/02/08<enter>");
80         assertEquals("Cell text in ALM1002 is not 01/02/08","01/02/08", SCTool.getCellText("ALM1002"));
81 
82         SCTool.selectRange("ALM1003");
83         scInputBarInput.activate();
84         typeKeys("01/01/08<enter>");
85         assertEquals("Have no alert message","Invalid value", activeMsgBox.getMessage());
86         activeMsgBox.ok();
87         assertEquals("Validity have not filter invalid value","", SCTool.getCellText("ALM1003"));
88 
89         SCTool.selectRange("AML1003");
90         scInputBarInput.activate();
91         typeKeys("12/31/07<enter>");
92         assertEquals("Have no alert message","Invalid value", activeMsgBox.getMessage());
93         activeMsgBox.ok();
94         assertEquals("Validity have not filter invalid value","", SCTool.getCellText("AML1003"));
95     }
96 }
97