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 
22*80a6f5c5SLiu 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 
3304bad30fSLiu Zhe public class ValidityDialogDefaultValue {
3404bad30fSLiu Zhe 
3504bad30fSLiu Zhe 	@Rule
3622a14f28SLiu Zhe 	public Logger log = Logger.getLogger(this);
3704bad30fSLiu Zhe 
3804bad30fSLiu Zhe 	@Before
3904bad30fSLiu Zhe 	public void setUp() throws Exception {
404d3496b1SLiu Zhe 		app.start(true);
4104bad30fSLiu Zhe 
4204bad30fSLiu Zhe 		// New a spreadsheet, open Validity dialog
433816404dSLiu Zhe 		app.dispatch("private:factory/scalc");
443816404dSLiu Zhe 		app.dispatch(".uno:Validation");
4504bad30fSLiu Zhe 	}
4604bad30fSLiu Zhe 
4704bad30fSLiu Zhe 	@After
4804bad30fSLiu Zhe 	public void tearDown() throws Exception {
4922a14f28SLiu Zhe 
5004bad30fSLiu Zhe 	}
5104bad30fSLiu Zhe 
5204bad30fSLiu Zhe 	/**
5304bad30fSLiu Zhe 	 * test Data -> Validity - UI(Criteria: Cell range).
5404bad30fSLiu Zhe 	 */
5504bad30fSLiu Zhe 	@Test
5604bad30fSLiu Zhe 	public void testValidityUICellRange() {
5704bad30fSLiu Zhe 
58b4d2d410SLiu Zhe 		scValidityCriteriaTabpage.select();
59b4d2d410SLiu Zhe 		scValidityCriteriaAllowList.select(5); // "Cell range"
6022a14f28SLiu Zhe 
61b4d2d410SLiu Zhe 		assertEquals(true, scValidityAllowBlankCells.isChecked());
62b4d2d410SLiu Zhe 		assertEquals(true, scValidityShowSelectionList.isChecked());
63b4d2d410SLiu Zhe 		assertEquals(false, scValiditySortEntriesAscending.isChecked());
64b4d2d410SLiu Zhe 		assertEquals(true, scValidityAllowBlankCells.isEnabled());
65b4d2d410SLiu Zhe 		assertEquals(true, scValiditySortEntriesAscending.isEnabled());
66b4d2d410SLiu Zhe 		assertEquals(true, scValiditySortEntriesAscending.isEnabled());
67b4d2d410SLiu Zhe 		assertEquals(true, scValiditySourcePicker.isEnabled());
6804bad30fSLiu Zhe 	}
6904bad30fSLiu Zhe 
7004bad30fSLiu Zhe 	/**
7104bad30fSLiu Zhe 	 * test Data -> Validity - UI(Error Alert: Default status)
7204bad30fSLiu Zhe 	 */
7304bad30fSLiu Zhe 	@Test
7404bad30fSLiu Zhe 	public void testValidityUIErrorAlert() {
7504bad30fSLiu Zhe 
76b4d2d410SLiu Zhe 		scValidityErrorAlertTabPage.select();
77b4d2d410SLiu Zhe 		assertEquals(true, scValidityErrorAlertActionList.isEnabled());
7822a14f28SLiu Zhe 		// assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText()); //
7922a14f28SLiu Zhe 		// Do not test this. Do it in GVT.
80b4d2d410SLiu Zhe 		assertEquals(true, scValidityErrorMessageTitle.isEnabled());
81b4d2d410SLiu Zhe 		assertEquals("", scValidityErrorMessageTitle.getText());
82b4d2d410SLiu Zhe 		assertEquals(true, scValidityErrorMessage.isEnabled());
83b4d2d410SLiu Zhe 		assertEquals("", scValidityErrorMessage.getText());
84b4d2d410SLiu Zhe 		scValidityErrorAlertActionList.select(3); // "Macro"
85b4d2d410SLiu Zhe 		assertEquals(true, scValidityErrorBrowseButton.isEnabled());
8604bad30fSLiu Zhe 	}
8704bad30fSLiu Zhe 
8804bad30fSLiu Zhe }
89