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 
33*424494b0SLi Feng Wang import testlib.gui.AppTool;
3404bad30fSLiu Zhe 
35*424494b0SLi Feng Wang public class ValidityDialogDefaultValue {
3604bad30fSLiu Zhe 
3704bad30fSLiu Zhe 	@Before
3804bad30fSLiu Zhe 	public void setUp() throws Exception {
394d3496b1SLiu Zhe 		app.start(true);
40*424494b0SLi Feng Wang 		AppTool.newSpreadsheet();
413816404dSLiu Zhe 		app.dispatch(".uno:Validation");
4204bad30fSLiu Zhe 	}
4304bad30fSLiu Zhe 
4404bad30fSLiu Zhe 	@After
4504bad30fSLiu Zhe 	public void tearDown() throws Exception {
46*424494b0SLi Feng Wang 		app.stop();
4704bad30fSLiu Zhe 	}
4804bad30fSLiu Zhe 
4904bad30fSLiu Zhe 	/**
5004bad30fSLiu Zhe 	 * test Data -> Validity - UI(Criteria: Cell range).
5104bad30fSLiu Zhe 	 */
5204bad30fSLiu Zhe 	@Test
5304bad30fSLiu Zhe 	public void testValidityUICellRange() {
5404bad30fSLiu Zhe 
55b4d2d410SLiu Zhe 		scValidityCriteriaTabpage.select();
56*424494b0SLi Feng Wang 		scValidityCriteriaAllowList.select(5);
5722a14f28SLiu Zhe 
58*424494b0SLi Feng Wang 		assertEquals("Wrong default value of AllowBlankCells in Validity",true, scValidityAllowBlankCells.isChecked());
59*424494b0SLi Feng Wang 		assertEquals("Wrong default value of ShowSelectionList in Validity",true, scValidityShowSelectionList.isChecked());
60*424494b0SLi Feng Wang 		assertEquals("Wrong default value of Sort Entries Ascending in Validity",false, scValiditySortEntriesAscending.isChecked());
61*424494b0SLi Feng Wang 		assertEquals("Wrong default value of AllowBlankCells in Validity",true, scValidityAllowBlankCells.isEnabled());
62*424494b0SLi Feng Wang 		assertEquals("Wrong default value of Sort Entries Ascending in Validity",true, scValiditySortEntriesAscending.isEnabled());
63*424494b0SLi Feng Wang 		assertEquals("Wrong default value of SourcePicker in Validity",true, scValiditySourcePicker.isEnabled());
6404bad30fSLiu Zhe 	}
6504bad30fSLiu Zhe 
6604bad30fSLiu Zhe 	/**
6704bad30fSLiu Zhe 	 * test Data -> Validity - UI(Error Alert: Default status)
6804bad30fSLiu Zhe 	 */
6904bad30fSLiu Zhe 	@Test
7004bad30fSLiu Zhe 	public void testValidityUIErrorAlert() {
7104bad30fSLiu Zhe 
72b4d2d410SLiu Zhe 		scValidityErrorAlertTabPage.select();
73*424494b0SLi Feng Wang 		assertEquals("Error Alert Action list is disable",true, scValidityErrorAlertActionList.isEnabled());
74*424494b0SLi Feng Wang 		// assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText());
7522a14f28SLiu Zhe 		// Do not test this. Do it in GVT.
76*424494b0SLi Feng Wang 		assertEquals("Error Message Title is disable",true, scValidityErrorMessageTitle.isEnabled());
77*424494b0SLi Feng Wang 		assertEquals("Have default error message title","", scValidityErrorMessageTitle.getText());
78*424494b0SLi Feng Wang 		assertEquals("Error message is disable",true, scValidityErrorMessage.isEnabled());
79*424494b0SLi Feng Wang 		assertEquals("Have default error message","", scValidityErrorMessage.getText());
80b4d2d410SLiu Zhe 		scValidityErrorAlertActionList.select(3); // "Macro"
81*424494b0SLi Feng Wang 		assertEquals("error browse button is disable",true, scValidityErrorBrowseButton.isEnabled());
8204bad30fSLiu Zhe 	}
8304bad30fSLiu Zhe 
8404bad30fSLiu Zhe }
85