104bad30fSLiu Zhe /**************************************************************
204bad30fSLiu Zhe  *
304bad30fSLiu Zhe  * Licensed to the Apache Software Foundation (ASF) under one
404bad30fSLiu Zhe  * or more contributor license agreements.  See the NOTICE file
504bad30fSLiu Zhe  * distributed with this work for additional information
604bad30fSLiu Zhe  * regarding copyright ownership.  The ASF licenses this file
704bad30fSLiu Zhe  * to you under the Apache License, Version 2.0 (the
804bad30fSLiu Zhe  * "License"); you may not use this file except in compliance
904bad30fSLiu Zhe  * with the License.  You may obtain a copy of the License at
1004bad30fSLiu Zhe  *
1104bad30fSLiu Zhe  *   http://www.apache.org/licenses/LICENSE-2.0
1204bad30fSLiu Zhe  *
1304bad30fSLiu Zhe  * Unless required by applicable law or agreed to in writing,
1404bad30fSLiu Zhe  * software distributed under the License is distributed on an
1504bad30fSLiu Zhe  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1604bad30fSLiu Zhe  * KIND, either express or implied.  See the License for the
1704bad30fSLiu Zhe  * specific language governing permissions and limitations
1804bad30fSLiu Zhe  * under the License.
1904bad30fSLiu Zhe  *
2004bad30fSLiu Zhe  *************************************************************/
2104bad30fSLiu Zhe 
2280a6f5c5SLiu Zhe package fvt.gui.sc.validity;
2395269d92SLiu Zhe 
2422a14f28SLiu Zhe import static org.junit.Assert.*;
2595269d92SLiu Zhe import static testlib.gui.UIMap.*;
2604bad30fSLiu Zhe 
2704bad30fSLiu Zhe import org.junit.After;
2804bad30fSLiu Zhe import org.junit.Before;
2904bad30fSLiu Zhe import org.junit.Rule;
3004bad30fSLiu Zhe import org.junit.Test;
3122a14f28SLiu Zhe import org.openoffice.test.common.Logger;
3204bad30fSLiu Zhe 
33424494b0SLi Feng Wang import testlib.gui.AppTool;
3404bad30fSLiu Zhe 
35424494b0SLi Feng Wang public class ValidityDialogDefaultValue {
3604bad30fSLiu Zhe 
37*fd348426SLi Feng Wang 	@Rule
38*fd348426SLi Feng Wang 	public Logger log = Logger.getLogger(this);
39*fd348426SLi Feng Wang 
4004bad30fSLiu Zhe 	@Before
setUp()4104bad30fSLiu Zhe 	public void setUp() throws Exception {
424d3496b1SLiu Zhe 		app.start(true);
43424494b0SLi Feng Wang 		AppTool.newSpreadsheet();
443816404dSLiu Zhe 		app.dispatch(".uno:Validation");
4504bad30fSLiu Zhe 	}
4604bad30fSLiu Zhe 
4704bad30fSLiu Zhe 	@After
tearDown()4804bad30fSLiu Zhe 	public void tearDown() throws Exception {
49424494b0SLi Feng Wang 		app.stop();
5004bad30fSLiu Zhe 	}
5104bad30fSLiu Zhe 
5204bad30fSLiu Zhe 	/**
5304bad30fSLiu Zhe 	 * test Data -> Validity - UI(Criteria: Cell range).
5404bad30fSLiu Zhe 	 */
5504bad30fSLiu Zhe 	@Test
testValidityUICellRange()5604bad30fSLiu Zhe 	public void testValidityUICellRange() {
5704bad30fSLiu Zhe 
58b4d2d410SLiu Zhe 		scValidityCriteriaTabpage.select();
59424494b0SLi Feng Wang 		scValidityCriteriaAllowList.select(5);
6022a14f28SLiu Zhe 
61424494b0SLi Feng Wang 		assertEquals("Wrong default value of AllowBlankCells in Validity",true, scValidityAllowBlankCells.isChecked());
62424494b0SLi Feng Wang 		assertEquals("Wrong default value of ShowSelectionList in Validity",true, scValidityShowSelectionList.isChecked());
63424494b0SLi Feng Wang 		assertEquals("Wrong default value of Sort Entries Ascending in Validity",false, scValiditySortEntriesAscending.isChecked());
64424494b0SLi Feng Wang 		assertEquals("Wrong default value of AllowBlankCells in Validity",true, scValidityAllowBlankCells.isEnabled());
65424494b0SLi Feng Wang 		assertEquals("Wrong default value of Sort Entries Ascending in Validity",true, scValiditySortEntriesAscending.isEnabled());
66424494b0SLi Feng Wang 		assertEquals("Wrong default value of SourcePicker in Validity",true, scValiditySourcePicker.isEnabled());
6704bad30fSLiu Zhe 	}
6804bad30fSLiu Zhe 
6904bad30fSLiu Zhe 	/**
7004bad30fSLiu Zhe 	 * test Data -> Validity - UI(Error Alert: Default status)
7104bad30fSLiu Zhe 	 */
7204bad30fSLiu Zhe 	@Test
testValidityUIErrorAlert()7304bad30fSLiu Zhe 	public void testValidityUIErrorAlert() {
7404bad30fSLiu Zhe 
75b4d2d410SLiu Zhe 		scValidityErrorAlertTabPage.select();
76424494b0SLi Feng Wang 		assertEquals("Error Alert Action list is disable",true, scValidityErrorAlertActionList.isEnabled());
77424494b0SLi Feng Wang 		// assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText());
7822a14f28SLiu Zhe 		// Do not test this. Do it in GVT.
79424494b0SLi Feng Wang 		assertEquals("Error Message Title is disable",true, scValidityErrorMessageTitle.isEnabled());
80424494b0SLi Feng Wang 		assertEquals("Have default error message title","", scValidityErrorMessageTitle.getText());
81424494b0SLi Feng Wang 		assertEquals("Error message is disable",true, scValidityErrorMessage.isEnabled());
82424494b0SLi Feng Wang 		assertEquals("Have default error message","", scValidityErrorMessage.getText());
83b4d2d410SLiu Zhe 		scValidityErrorAlertActionList.select(3); // "Macro"
84424494b0SLi Feng Wang 		assertEquals("error browse button is disable",true, scValidityErrorBrowseButton.isEnabled());
8504bad30fSLiu Zhe 	}
8604bad30fSLiu Zhe 
8704bad30fSLiu Zhe }
88