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 
23 
24 package testcase.gui.sc.validity;
25 
26 import static testlib.gui.UIMap.*;
27 
28 import org.junit.After;
29 import static org.junit.Assert.*;
30 import org.junit.Before;
31 import org.junit.Rule;
32 import org.junit.Test;
33 
34 import testlib.gui.Log;
35 
36 
37 public class ValidityDialogDefaultValue {
38 
39 	@Rule
40 	public Log LOG = new Log();
41 
42 	@Before
43 	public void setUp() throws Exception {
44 		app.start();
45 
46 		// New a spreadsheet, open Validity dialog
47 		startcenter.menuItem("File->New->Spreadsheet").select();
48 		calc.menuItem("Data->Validity...").select();
49 	}
50 
51 	@After
52 	public void tearDown() throws Exception {
53 		app.close();
54 	}
55 
56 	/**
57 	 * test Data -> Validity - UI(Criteria: Cell range).
58 	 */
59 	@Test
60 	public void testValidityUICellRange() {
61 
62 		SC_ValidityCriteriaTabpage.select();
63 		SC_ValidityCriteriaAllowList.select("Cell range");
64 
65 		assertEquals(true,SC_ValidityAllowBlankCells.isChecked());
66 		assertEquals(true,SC_ValidityShowSelectionList.isChecked());
67 		assertEquals(false,SC_ValiditySortEntriesAscending.isChecked());
68 		assertEquals(true,SC_ValidityAllowBlankCells.isEnabled());
69 		assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled());
70 		assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled());
71 		assertEquals(true,SC_ValiditySourcePicker.isEnabled());
72 	}
73 
74 	/**
75 	 * test Data -> Validity - UI(Error Alert: Default status)
76 	 */
77 	@Test
78 	public void testValidityUIErrorAlert() {
79 
80 		SC_ValidityErrorAlertTabPage.select();
81 		assertEquals(true,SC_ValidityErrorAlertActionList.isEnabled());
82 		assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText());
83 		assertEquals(true,SC_ValidityErrorMessageTitle.isEnabled());
84 		assertEquals("",SC_ValidityErrorMessageTitle.getText());
85 		assertEquals(true,SC_ValidityErrorMessage.isEnabled());
86 		assertEquals("",SC_ValidityErrorMessage.getText());
87 		SC_ValidityErrorAlertActionList.select("Macro");
88 		assertEquals(true,SC_ValidityErrorBrowseButton.isEnabled());
89 	}
90 
91 }
92 
93