xref: /trunk/test/testgui/source/fvt/gui/sc/validity/ValidityDialogDefaultValue.java (revision 424494b095bc90dc2fe31bd4233af124f1760355)
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     @Before
38     public void setUp() throws Exception {
39         app.start(true);
40         AppTool.newSpreadsheet();
41         app.dispatch(".uno:Validation");
42     }
43 
44     @After
45     public void tearDown() throws Exception {
46         app.stop();
47     }
48 
49     /**
50      * test Data -> Validity - UI(Criteria: Cell range).
51      */
52     @Test
53     public void testValidityUICellRange() {
54 
55         scValidityCriteriaTabpage.select();
56         scValidityCriteriaAllowList.select(5);
57 
58         assertEquals("Wrong default value of AllowBlankCells in Validity",true, scValidityAllowBlankCells.isChecked());
59         assertEquals("Wrong default value of ShowSelectionList in Validity",true, scValidityShowSelectionList.isChecked());
60         assertEquals("Wrong default value of Sort Entries Ascending in Validity",false, scValiditySortEntriesAscending.isChecked());
61         assertEquals("Wrong default value of AllowBlankCells in Validity",true, scValidityAllowBlankCells.isEnabled());
62         assertEquals("Wrong default value of Sort Entries Ascending in Validity",true, scValiditySortEntriesAscending.isEnabled());
63         assertEquals("Wrong default value of SourcePicker in Validity",true, scValiditySourcePicker.isEnabled());
64     }
65 
66     /**
67      * test Data -> Validity - UI(Error Alert: Default status)
68      */
69     @Test
70     public void testValidityUIErrorAlert() {
71 
72         scValidityErrorAlertTabPage.select();
73         assertEquals("Error Alert Action list is disable",true, scValidityErrorAlertActionList.isEnabled());
74         // assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText());
75         // Do not test this. Do it in GVT.
76         assertEquals("Error Message Title is disable",true, scValidityErrorMessageTitle.isEnabled());
77         assertEquals("Have default error message title","", scValidityErrorMessageTitle.getText());
78         assertEquals("Error message is disable",true, scValidityErrorMessage.isEnabled());
79         assertEquals("Have default error message","", scValidityErrorMessage.getText());
80         scValidityErrorAlertActionList.select(3); // "Macro"
81         assertEquals("error browse button is disable",true, scValidityErrorBrowseButton.isEnabled());
82     }
83 
84 }
85