1b164ae3eSLei De Bin /**************************************************************
2b164ae3eSLei De Bin  *
3b164ae3eSLei De Bin  * Licensed to the Apache Software Foundation (ASF) under one
4b164ae3eSLei De Bin  * or more contributor license agreements.  See the NOTICE file
5b164ae3eSLei De Bin  * distributed with this work for additional information
6b164ae3eSLei De Bin  * regarding copyright ownership.  The ASF licenses this file
7b164ae3eSLei De Bin  * to you under the Apache License, Version 2.0 (the
8b164ae3eSLei De Bin  * "License"); you may not use this file except in compliance
9b164ae3eSLei De Bin  * with the License.  You may obtain a copy of the License at
10b164ae3eSLei De Bin  *
11b164ae3eSLei De Bin  *   http://www.apache.org/licenses/LICENSE-2.0
12b164ae3eSLei De Bin  *
13b164ae3eSLei De Bin  * Unless required by applicable law or agreed to in writing,
14b164ae3eSLei De Bin  * software distributed under the License is distributed on an
15b164ae3eSLei De Bin  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b164ae3eSLei De Bin  * KIND, either express or implied.  See the License for the
17b164ae3eSLei De Bin  * specific language governing permissions and limitations
18b164ae3eSLei De Bin  * under the License.
19b164ae3eSLei De Bin  *
20b164ae3eSLei De Bin  *************************************************************/
21b164ae3eSLei De Bin 
2280a6f5c5SLiu Zhe package fvt.gui.sc.validity;
23faa4b864SLei De Bin 
2422a14f28SLiu Zhe import static org.junit.Assert.*;
25b4d2d410SLiu Zhe import static testlib.gui.AppTool.*;
2695269d92SLiu Zhe import static testlib.gui.UIMap.*;
27faa4b864SLei De Bin 
28faa4b864SLei De Bin import org.junit.After;
29faa4b864SLei De Bin import org.junit.Before;
30faa4b864SLei De Bin import org.junit.Rule;
31faa4b864SLei De Bin import org.junit.Test;
3222a14f28SLiu Zhe import org.openoffice.test.common.Logger;
33faa4b864SLei De Bin 
34424494b0SLi Feng Wang import testlib.gui.AppTool;
35b4d2d410SLiu Zhe import testlib.gui.SCTool;
36faa4b864SLei De Bin 
37faa4b864SLei De Bin public class ValidityDateSupport1024Columns {
3894794f51SLiu Zhe 
39*fd348426SLi Feng Wang 	@Rule
40*fd348426SLi Feng Wang 	public Logger log = Logger.getLogger(this);
41*fd348426SLi Feng Wang 
42faa4b864SLei De Bin 	@Before
setUp()43faa4b864SLei De Bin 	public void setUp() throws Exception {
444d3496b1SLiu Zhe 		app.start(true);
45424494b0SLi Feng Wang 		AppTool.newSpreadsheet();
4694794f51SLiu Zhe 	}
4794794f51SLiu Zhe 
4894794f51SLiu Zhe 	@After
tearDown()49424494b0SLi Feng Wang 	public void tearDown() throws Exception {
50424494b0SLi Feng Wang 		app.stop();
51faa4b864SLei De Bin 	}
5294794f51SLiu Zhe 
53faa4b864SLei De Bin 	/**
5422a14f28SLiu Zhe 	 * test Allow Greater than or equal to Date type in Validity, support 1024
5522a14f28SLiu Zhe 	 * columns.
56faa4b864SLei De Bin 	 */
57faa4b864SLei De Bin 	@Test
testValidityDateSupport1024Columns()58faa4b864SLei De Bin 	public void testValidityDateSupport1024Columns() {
59b4d2d410SLiu Zhe 		SCTool.selectRange("ALM1000:ALO1005");
603816404dSLiu Zhe 		app.dispatch(".uno:Validation");
6194794f51SLiu Zhe 
62b4d2d410SLiu Zhe 		scValidityCriteriaTabpage.select();
63b4d2d410SLiu Zhe 		scValidityCriteriaAllowList.select(3); // "Date"
64b4d2d410SLiu Zhe 		scValidityDecimalCompareOperator.select(2); // "greater than"
65b4d2d410SLiu Zhe 		scValiditySourceInput.setText("01/01/08");
66b4d2d410SLiu Zhe 		scValidityErrorAlertTabPage.select();
67b4d2d410SLiu Zhe 		scValidityShowErrorMessage.check();
68b4d2d410SLiu Zhe 		scValidityErrorMessageTitle.setText("Stop to enter");
69b4d2d410SLiu Zhe 		scValidityErrorMessage.setText("Invalid value");
70b4d2d410SLiu Zhe 		scValidityErrorAlertTabPage.ok();
71b4d2d410SLiu Zhe 
72b4d2d410SLiu Zhe 		SCTool.selectRange("ALM1001");
73b4d2d410SLiu Zhe 		scInputBarInput.activate();
7494794f51SLiu 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"));
7694794f51SLiu Zhe 
77b4d2d410SLiu Zhe 		SCTool.selectRange("ALM1002");
78b4d2d410SLiu Zhe 		scInputBarInput.activate();
7994794f51SLiu 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"));
8194794f51SLiu Zhe 
82b4d2d410SLiu Zhe 		SCTool.selectRange("ALM1003");
83b4d2d410SLiu Zhe 		scInputBarInput.activate();
8494794f51SLiu 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"));
88faa4b864SLei De Bin 
89b4d2d410SLiu Zhe 		SCTool.selectRange("AML1003");
90b4d2d410SLiu Zhe 		scInputBarInput.activate();
9194794f51SLiu 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"));
9594794f51SLiu Zhe 	}
96faa4b864SLei De Bin }
97