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 
40 	@Before
41 	public void setUp() throws Exception {
42 		app.start(true);
43 		AppTool.newSpreadsheet();
44 	}
45 
46 	@After
47 	public void tearDown() throws Exception {
48 		app.stop();
49 	}
50 
51 	/**
52 	 * test Allow Greater than or equal to Date type in Validity, support 1024
53 	 * columns.
54 	 */
55 	@Test
56 	public void testValidityDateSupport1024Columns() {
57 		SCTool.selectRange("ALM1000:ALO1005");
58 		app.dispatch(".uno:Validation");
59 
60 		scValidityCriteriaTabpage.select();
61 		scValidityCriteriaAllowList.select(3); // "Date"
62 		scValidityDecimalCompareOperator.select(2); // "greater than"
63 		scValiditySourceInput.setText("01/01/08");
64 		scValidityErrorAlertTabPage.select();
65 		scValidityShowErrorMessage.check();
66 		scValidityErrorMessageTitle.setText("Stop to enter");
67 		scValidityErrorMessage.setText("Invalid value");
68 		scValidityErrorAlertTabPage.ok();
69 
70 		SCTool.selectRange("ALM1001");
71 		scInputBarInput.activate();
72 		typeKeys("02/01/08<enter>");
73 		assertEquals("Cell text in ALM1001 is not 02/01/08","02/01/08", SCTool.getCellText("ALM1001"));
74 
75 		SCTool.selectRange("ALM1002");
76 		scInputBarInput.activate();
77 		typeKeys("01/02/08<enter>");
78 		assertEquals("Cell text in ALM1002 is not 01/02/08","01/02/08", SCTool.getCellText("ALM1002"));
79 
80 		SCTool.selectRange("ALM1003");
81 		scInputBarInput.activate();
82 		typeKeys("01/01/08<enter>");
83 		assertEquals("Have no alert message","Invalid value", activeMsgBox.getMessage());
84 		activeMsgBox.ok();
85 		assertEquals("Validity have not filter invalid value","", SCTool.getCellText("ALM1003"));
86 
87 		SCTool.selectRange("AML1003");
88 		scInputBarInput.activate();
89 		typeKeys("12/31/07<enter>");
90 		assertEquals("Have no alert message","Invalid value", activeMsgBox.getMessage());
91 		activeMsgBox.ok();
92 		assertEquals("Validity have not filter invalid value","", SCTool.getCellText("AML1003"));
93 	}
94 }
95