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 java.io.File;
29 
30 import org.junit.After;
31 import org.junit.Before;
32 import org.junit.Rule;
33 import org.junit.Test;
34 import org.openoffice.test.common.Logger;
35 import org.openoffice.test.vcl.IDList;
36 import org.openoffice.test.vcl.widgets.VclMessageBox;
37 
38 import testlib.gui.SCTool;
39 
40 public class ValidityDateSupport1024Columns {
41 	private static IDList idList = new IDList(new File("./ids"));
42 	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
43 
44 	@Rule
45 	public Logger log = Logger.getLogger(this);
46 
47 	@Before
48 	public void setUp() throws Exception {
49 		app.start(true);
50 	}
51 
52 	@After
53 	public void tearDown() throws Exception {
54 
55 	}
56 
57 	/**
58 	 * test Allow Greater than or equal to Date type in Validity, support 1024
59 	 * columns.
60 	 */
61 	@Test
62 	public void testValidityDateSupport1024Columns() {
63 		app.dispatch("private:factory/scalc");
64 		SCTool.selectRange("ALM1000:ALO1005");
65 		app.dispatch(".uno:Validation");
66 
67 		scValidityCriteriaTabpage.select();
68 		scValidityCriteriaAllowList.select(3); // "Date"
69 		scValidityDecimalCompareOperator.select(2); // "greater than"
70 		scValiditySourceInput.setText("01/01/08");
71 		scValidityErrorAlertTabPage.select();
72 		scValidityShowErrorMessage.check();
73 		scValidityErrorMessageTitle.setText("Stop to enter");
74 		scValidityErrorMessage.setText("Invalid value");
75 		scValidityErrorAlertTabPage.ok();
76 
77 		SCTool.selectRange("ALM1001");
78 		scInputBarInput.activate();
79 		typeKeys("02/01/08<enter>");
80 		assertEquals("02/01/08", SCTool.getCellText("ALM1001"));
81 
82 		SCTool.selectRange("ALM1002");
83 		scInputBarInput.activate();
84 		typeKeys("01/02/08<enter>");
85 		assertEquals("01/02/08", SCTool.getCellText("ALM1002"));
86 
87 		SCTool.selectRange("ALM1003");
88 		scInputBarInput.activate();
89 		typeKeys("01/01/08<enter>");
90 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
91 		ActiveMsgBox.ok();
92 		assertEquals("", SCTool.getCellText("ALM1003"));
93 
94 		SCTool.selectRange("AML1003");
95 		scInputBarInput.activate();
96 		typeKeys("12/31/07<enter>");
97 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
98 		ActiveMsgBox.ok();
99 		assertEquals("", SCTool.getCellText("AML1003"));
100 	}
101 }
102