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.SCTool;
35 
36 public class ValidityDateSupport1024Columns {
37 
38 	@Rule
39 	public Logger log = Logger.getLogger(this);
40 
41 	@Before
42 	public void setUp() throws Exception {
43 		app.start(true);
44 	}
45 
46 	@After
47 	public void tearDown() throws Exception {
48 
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 		app.dispatch("private:factory/scalc");
58 		SCTool.selectRange("ALM1000:ALO1005");
59 		app.dispatch(".uno:Validation");
60 
61 		scValidityCriteriaTabpage.select();
62 		scValidityCriteriaAllowList.select(3); // "Date"
63 		scValidityDecimalCompareOperator.select(2); // "greater than"
64 		scValiditySourceInput.setText("01/01/08");
65 		scValidityErrorAlertTabPage.select();
66 		scValidityShowErrorMessage.check();
67 		scValidityErrorMessageTitle.setText("Stop to enter");
68 		scValidityErrorMessage.setText("Invalid value");
69 		scValidityErrorAlertTabPage.ok();
70 
71 		SCTool.selectRange("ALM1001");
72 		scInputBarInput.activate();
73 		typeKeys("02/01/08<enter>");
74 		assertEquals("02/01/08", SCTool.getCellText("ALM1001"));
75 
76 		SCTool.selectRange("ALM1002");
77 		scInputBarInput.activate();
78 		typeKeys("01/02/08<enter>");
79 		assertEquals("01/02/08", SCTool.getCellText("ALM1002"));
80 
81 		SCTool.selectRange("ALM1003");
82 		scInputBarInput.activate();
83 		typeKeys("01/01/08<enter>");
84 		assertEquals("Invalid value", activeMsgBox.getMessage());
85 		activeMsgBox.ok();
86 		assertEquals("", SCTool.getCellText("ALM1003"));
87 
88 		SCTool.selectRange("AML1003");
89 		scInputBarInput.activate();
90 		typeKeys("12/31/07<enter>");
91 		assertEquals("Invalid value", activeMsgBox.getMessage());
92 		activeMsgBox.ok();
93 		assertEquals("", SCTool.getCellText("AML1003"));
94 	}
95 }
96