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.UIMap.*;
26 
27 import org.junit.After;
28 import org.junit.Before;
29 import org.junit.Rule;
30 import org.junit.Test;
31 import org.openoffice.test.common.Logger;
32 
33 import testlib.gui.AppTool;
34 
35 public class ValidityDialogDefaultValue {
36 
37 	@Rule
38 	public Logger log = Logger.getLogger(this);
39 
40 	@Before
setUp()41 	public void setUp() throws Exception {
42 		app.start(true);
43 		AppTool.newSpreadsheet();
44 		app.dispatch(".uno:Validation");
45 	}
46 
47 	@After
tearDown()48 	public void tearDown() throws Exception {
49 		app.stop();
50 	}
51 
52 	/**
53 	 * test Data -> Validity - UI(Criteria: Cell range).
54 	 */
55 	@Test
testValidityUICellRange()56 	public void testValidityUICellRange() {
57 
58 		scValidityCriteriaTabpage.select();
59 		scValidityCriteriaAllowList.select(5);
60 
61 		assertEquals("Wrong default value of AllowBlankCells in Validity",true, scValidityAllowBlankCells.isChecked());
62 		assertEquals("Wrong default value of ShowSelectionList in Validity",true, scValidityShowSelectionList.isChecked());
63 		assertEquals("Wrong default value of Sort Entries Ascending in Validity",false, scValiditySortEntriesAscending.isChecked());
64 		assertEquals("Wrong default value of AllowBlankCells in Validity",true, scValidityAllowBlankCells.isEnabled());
65 		assertEquals("Wrong default value of Sort Entries Ascending in Validity",true, scValiditySortEntriesAscending.isEnabled());
66 		assertEquals("Wrong default value of SourcePicker in Validity",true, scValiditySourcePicker.isEnabled());
67 	}
68 
69 	/**
70 	 * test Data -> Validity - UI(Error Alert: Default status)
71 	 */
72 	@Test
testValidityUIErrorAlert()73 	public void testValidityUIErrorAlert() {
74 
75 		scValidityErrorAlertTabPage.select();
76 		assertEquals("Error Alert Action list is disable",true, scValidityErrorAlertActionList.isEnabled());
77 		// assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText());
78 		// Do not test this. Do it in GVT.
79 		assertEquals("Error Message Title is disable",true, scValidityErrorMessageTitle.isEnabled());
80 		assertEquals("Have default error message title","", scValidityErrorMessageTitle.getText());
81 		assertEquals("Error message is disable",true, scValidityErrorMessage.isEnabled());
82 		assertEquals("Have default error message","", scValidityErrorMessage.getText());
83 		scValidityErrorAlertActionList.select(3); // "Macro"
84 		assertEquals("error browse button is disable",true, scValidityErrorBrowseButton.isEnabled());
85 	}
86 
87 }
88