View | Details | Raw Unified | Return to issue 120321
Collapse All | Expand All

(-)src/testcase/sc/validity/ValidityCellRangeSourcePicker.java (-116 lines)
Lines 1-116 Link Here
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.sc.validity;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.io.File;
30
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
35
import org.junit.Before;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.vcl.IDList;
39
import org.openoffice.test.vcl.widgets.VclMessageBox;
40
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
46
public class ValidityCellRangeSourcePicker {
47
	private static IDList idList = new IDList(new File("./ids"));
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
49
	
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
56
	public Log LOG = new Log();
57
	
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	
71
	/**
72
	 * test Cell range source picker in Validity. Input from Edit Box.
73
	 */
74
	@Test
75
	public void testValidityCellRangeSourcePicker() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
		
79
		CalcUtil.selectRange("Sheet1.A1");
80
		calc.menuItem("Data->Validity...").select();	
81
		sleep(1);	
82
		
83
		
84
		SC_ValidityCriteriaTabpage.select();
85
		SC_ValidityCriteriaAllowList.select("Cell range");
86
		SC_ValiditySourcePicker.click();
87
		assertEquals(false,SC_ValidityCriteriaAllowList.exists());
88
		SC_ValiditySourceInput.setText("$Sheet1.$A$2:$C$5");
89
		SC_ValiditySourcePicker.click();
90
		assertEquals(true,SC_ValidityCriteriaAllowList.exists());
91
		typeKeys("<enter>");
92
		
93
		calc.focus();
94
		CalcUtil.selectRange("Sheet1.A2");
95
		SC_CellInput.activate();
96
		typeKeys("test");
97
		typeKeys("<enter>");
98
		
99
		CalcUtil.selectRange("Sheet1.A1");
100
		SC_CellInput.activate();
101
		typeKeys("test32");
102
		typeKeys("<enter>");
103
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
104
		ActiveMsgBox.focus();
105
		typeKeys("<enter>");
106
		
107
		CalcUtil.selectRange("Sheet1.A1");
108
		SC_CellInput.activate();
109
		typeKeys("test");
110
		typeKeys("<enter>");
111
		assertEquals("Test",CalcUtil.getCellText("Sheet1.A1"));
112
				
113
		}
114
115
}
116
(-)src/testcase/sc/datapilot/RemoveFunctionOfGroupedField.java (-139 lines)
Lines 1-139 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 *
50
 *
51
 */
52
public class RemoveFunctionOfGroupedField {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify the Remove function of Grouped field 
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();		
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
		}
95
		
96
		DataPilotFieldSelect.click(1, 1);
97
		DataPilotFieldSelect.openContextMenu();
98
		menuItem("Add to Page").select();
99
		assertEquals("Locale",CalcUtil.getCellText("A1"));
100
		sleep(1);
101
		
102
		DataPilotFieldSelect.click(1,30);
103
		DataPilotFieldSelect.openContextMenu();
104
		menuItem("Add to Column").select();
105
		assertEquals("Name",CalcUtil.getCellText("A3"));
106
		sleep(1);
107
		
108
		DataPilotFieldSelect.click(1,50);
109
		DataPilotFieldSelect.openContextMenu();
110
		menuItem("Add to Row").select();
111
		assertEquals("Date",CalcUtil.getCellText("A4"));
112
		sleep(1);
113
		
114
		DataPilotFieldSelect.click(1,70);
115
		DataPilotFieldSelect.openContextMenu();
116
		menuItem("Add to Data by->Sum").select();
117
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
118
		assertEquals("266773",CalcUtil.getCellText("J23"));
119
		sleep(1);
120
		
121
		CalcUtil.selectRange("B4:C4");
122
		SpreadSheetCells.openContextMenu();
123
		menuItem("Group->Group Selected Items").select();
124
		assertEquals("Name2",CalcUtil.getCellText("B3"));
125
		assertEquals("Name",CalcUtil.getCellText("C3"));
126
		assertEquals("Group1",CalcUtil.getCellText("D4"));
127
		assertEquals("266773",CalcUtil.getCellText("J24"));
128
		sleep(1);
129
		
130
		CalcUtil.selectRange("D4");
131
		SpreadSheetCells.openContextMenu();
132
		menuItem("Group->Ungroup").select();
133
		assertEquals("Name",CalcUtil.getCellText("B3"));
134
		assertEquals("",CalcUtil.getCellText("C3"));
135
		assertEquals("Bill Zhang",CalcUtil.getCellText("D4"));
136
		assertEquals("266773",CalcUtil.getCellText("J23"));
137
	}
138
139
}
(-)src/testcase/sc/datapilot/MoveFieldInSameAreaManualUpdate.java (-174 lines)
Lines 1-174 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 * 
50
 *
51
 */
52
public class MoveFieldInSameAreaManualUpdate {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while add fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();
83
		CreateDataPilotTableDialog.ok();
84
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
85
			DataPilotAutomaticallyUpdateCheckBox.check();
86
			
87
		}
88
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
89
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
90
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
91
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
92
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
93
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
94
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
95
		sleep(1);
96
		
97
		DataPilotFieldSelect.click(1, 1);
98
		DataPilotFieldSelect.openContextMenu();
99
		menuItem("Add to Column").select();
100
		assertEquals("Locale",CalcUtil.getCellText("A1"));
101
		sleep(1);
102
		
103
		DataPilotFieldSelect.click(1,30);
104
		DataPilotFieldSelect.openContextMenu();
105
		menuItem("Add to Column").select();
106
		assertEquals("Name",CalcUtil.getCellText("B1"));
107
		sleep(1);
108
		
109
		DataPilotFieldSelect.click(1,50);
110
		DataPilotFieldSelect.openContextMenu();
111
		menuItem("Add to Row").select();
112
		assertEquals("Date",CalcUtil.getCellText("A3"));
113
		sleep(1);
114
		
115
		DataPilotFieldSelect.click(1,70);
116
		DataPilotFieldSelect.openContextMenu();
117
		menuItem("Add to Row").select();
118
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
119
		sleep(1);
120
		
121
		DataPilotFieldSelect.click(1,90);
122
		DataPilotFieldSelect.openContextMenu();
123
		menuItem("Add to Data by->Sum").select();
124
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
125
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
126
		sleep(1);
127
		
128
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
129
		DataPilotColumnArea.drag(1, 1, 1, 60);
130
		assertEquals("Name",CalcUtil.getCellText("D1"));
131
		assertEquals("Locale",CalcUtil.getCellText("C1"));
132
		sleep(1);
133
		
134
		DataPilotPaneRowArea.drag(1,1, 1, 60);
135
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
136
		assertEquals("Date",CalcUtil.getCellText("A3"));
137
		sleep(1);
138
		
139
		CalcUtil.selectRange("A33");
140
		ActiveMsgBox.yes();
141
		assertEquals("Name",CalcUtil.getCellText("C1"));
142
		assertEquals("Locale",CalcUtil.getCellText("D1"));
143
		assertEquals("Order Number",CalcUtil.getCellText("A3"));
144
		assertEquals("Date",CalcUtil.getCellText("B3"));
145
		sleep(1);
146
		
147
		DataPilotColumnArea.click(1,1);
148
		DataPilotColumnArea.openContextMenu();
149
		menuItem("Move Down").select();
150
		assertEquals("Name",CalcUtil.getCellText("C1"));
151
		assertEquals("Locale",CalcUtil.getCellText("D1"));
152
		sleep(1);
153
		
154
		DataPilotPaneRowArea.click(1,30);
155
		DataPilotPaneRowArea.openContextMenu();
156
		menuItem("Move Up").select();
157
		assertEquals("Order Number",CalcUtil.getCellText("A3"));
158
		assertEquals("Date",CalcUtil.getCellText("B3"));
159
		sleep(1);
160
		
161
		CalcUtil.selectRange("A33");
162
		ActiveMsgBox.yes();
163
		assertEquals("Name",CalcUtil.getCellText("D1"));
164
		assertEquals("Locale",CalcUtil.getCellText("C1"));
165
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
166
		assertEquals("Date",CalcUtil.getCellText("A3"));
167
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
168
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
169
		DataPilotAutomaticallyUpdateCheckBox.check();
170
		sleep(1);
171
		
172
	}
173
174
}
(-)src/testcase/sw/table/Table.java (-1 / +1 lines)
Lines 24-30 Link Here
24
/**
24
/**
25
 * 
25
 * 
26
 */
26
 */
27
package testcase.textdocument.table;
27
package testcase.sw.table;
28
28
29
import static testlib.AppUtil.*;
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
30
import static testlib.UIMap.*;
(-)src/testcase/sc/datapilot/HideShowPanel.java (-165 lines)
Lines 1-165 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
49
/**
50
 * 
51
 *
52
 */
53
public class HideShowPanel {
54
	/**
55
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
56
	 * Collect extra data when OpenOffice crashes.
57
	 */
58
	@Rule
59
	public Log LOG = new Log();
60
61
	/**
62
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
63
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
64
	 * Reset OpenOffice to startcenter.
65
	 * 
66
	 * @throws java.lang.Exception
67
	 */
68
	@Before
69
	public void setUp() throws Exception {
70
		initApp();
71
	}
72
	/**
73
	 * 
74
	 * Verify that DP panel while switch focus among tables with same/different source range.
75
	 */
76
	@Test
77
	public void test() {
78
		String file = testFile("source_data01.ods");
79
		startcenter.menuItem("File->Open...").select();
80
		submitOpenDlg(file);
81
		sleep(2);
82
		CalcUtil.selectRange("A1:E27");
83
		calc.menuItem("Data->DataPilot->Start...").select();		
84
		CreateDataPilotTableDialog.ok();
85
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
86
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
87
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
88
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
89
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
90
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
91
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
92
		
93
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
94
			DataPilotAutomaticallyUpdateCheckBox.check();
95
		}
96
		
97
		DataPilotFieldSelect.click(1, 1);
98
		DataPilotFieldSelect.openContextMenu();
99
		menuItem("Add to Page").select();
100
		assertEquals("Locale",CalcUtil.getCellText("A1"));
101
		sleep(1);
102
		
103
		DataPilotFieldSelect.click(1,30);
104
		DataPilotFieldSelect.openContextMenu();
105
		menuItem("Add to Column").select();
106
		assertEquals("Name",CalcUtil.getCellText("A3"));
107
		sleep(1);
108
		
109
		DataPilotFieldSelect.click(1,50);
110
		DataPilotFieldSelect.openContextMenu();
111
		menuItem("Add to Row").select();
112
		assertEquals("Date",CalcUtil.getCellText("A4"));
113
		sleep(1);
114
		
115
		DataPilotFieldSelect.click(1,70);
116
		DataPilotFieldSelect.openContextMenu();
117
		menuItem("Add to Data by->Sum").select();
118
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
119
		assertEquals("266773",CalcUtil.getCellText("J23"));
120
		sleep(1);
121
		
122
		CalcUtil.selectRange("A1:J24");
123
		typeKeys("<$copy>");
124
		
125
		CalcUtil.selectRange("A26");
126
		typeKeys("<$paste>");
127
		assertEquals("Locale",CalcUtil.getCellText("A26"));
128
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
129
		assertEquals("Name",CalcUtil.getCellText("B28"));
130
		assertEquals("Date",CalcUtil.getCellText("A29"));
131
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
132
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
133
		assertEquals("266773",CalcUtil.getCellText("J48"));
134
		sleep(1);
135
136
		CalcUtil.selectRange("A1");
137
		SpreadSheetCells.openContextMenu();
138
		menuItem("Show DataPilot Panel").select();
139
		assertFalse(DataPilotPanel.exists());
140
		sleep(1);
141
		
142
		CalcUtil.selectRange("A1");
143
		SpreadSheetCells.openContextMenu();
144
		menuItem("Show DataPilot Panel").select();
145
		assertTrue(DataPilotPanel.exists());
146
		sleep(1);
147
		
148
		DataPilotPanel.close();
149
		assertFalse(DataPilotPanel.exists());
150
		sleep(1);
151
		
152
		CalcUtil.selectRange("A26");
153
		DataPilotButton.click();
154
		sleep(1);
155
		assertTrue(DataPilotPanel.exists());
156
		assertEquals("Locale",CalcUtil.getCellText("A26"));
157
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
158
		assertEquals("Name",CalcUtil.getCellText("B28"));
159
		assertEquals("Date",CalcUtil.getCellText("A29"));
160
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
161
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
162
		assertEquals("266773",CalcUtil.getCellText("J48"));
163
	}
164
165
}
(-)src/testcase/presentation/headerandfooter/OpenDocumentWithHeaderFooter.java (-171 lines)
Lines 1-171 Link Here
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
/**
25
 * 
26
 */
27
package testcase.presentation.headerandfooter;
28
29
import static testlib.AppUtil.fullPath;
30
import static testlib.AppUtil.openStartcenter;
31
import static testlib.AppUtil.submitSaveDlg;
32
import static testlib.AppUtil.submitOpenDlg;
33
import static testlib.AppUtil.testFile;
34
import static testlib.UIMap.*;
35
import static org.junit.Assert.*;
36
import static org.openoffice.test.vcl.Tester.*;
37
import org.junit.After;
38
import org.junit.Before;
39
import org.junit.Rule;
40
import org.junit.Test;
41
import org.openoffice.test.common.FileUtil;
42
import testlib.Log;
43
44
public class OpenDocumentWithHeaderFooter {
45
46
	@Rule
47
	public Log LOG = new Log();
48
49
	@Before
50
	public void setUp() throws Exception {
51
		app.start();
52
	}
53
54
	@After
55
	public void tearDown() throws Exception {
56
		app.close();
57
	}
58
59
	/**
60
	 * Test open AOO3.4 presentation with header and footer.
61
	 * edit and save to ODP
62
	 * @throws Exception
63
	 */
64
	@Test
65
	public void testOpenAOO34WithHeaderFooter() throws Exception{
66
		//open sample file
67
		String file = testFile("sd/AOO3.4HeaderFooter.odp");
68
		app.dispatch(".uno:Open");
69
		submitOpenDlg(file);
70
71
		//check after reopen		
72
		impress.menuItem("View->Header and Footer...").select();
73
		sleep(1);
74
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
75
		assertEquals("fixed date",SD_FixedDateAndTimeOnSlideInput.getText());
76
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
77
		assertEquals("footer test",SD_FooterTextOnSlideInput.getText());
78
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
79
80
		SD_SlideNumAsFooterOnSlide.uncheck();
81
		SD_ApplyToAllButtonOnSlideFooter.click();
82
83
		//save to odp and reopen
84
		impress.menuItem("File->Save As...").select();
85
		String saveTo2 = fullPath("temp/" + "AOO3.4HeaderFooter.odp");
86
		FileUtil.deleteFile(saveTo2);
87
		submitSaveDlg(saveTo2);	
88
		impress.menuItem("File->Close").select();
89
		sleep(1);
90
91
		openStartcenter();
92
		app.dispatch(".uno:Open");
93
		String openFrom2=fullPath("temp/" + "AOO3.4HeaderFooter.odp");
94
		submitOpenDlg(openFrom2);
95
96
		impress.menuItem("View->Header and Footer...").select();
97
		sleep(1);
98
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
99
		//end-save to odp and reopen
100
	}
101
102
	/**
103
	 * Test open ppt file with header and footer.
104
	 * edit and save to PPT/ODP
105
	 * @throws Exception
106
	 */
107
	@Test
108
	public void testOpenPPTWithHeaderFooter() throws Exception{
109
		//open sample file
110
		String file = testFile("sd/gfdd.ppt");
111
		app.dispatch(".uno:Open");
112
		submitOpenDlg(file);
113
114
		//check after reopen		
115
		impress.menuItem("View->Header and Footer...").select();
116
		sleep(1);
117
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
118
		assertEquals("testdte",SD_FixedDateAndTimeOnSlideInput.getText());
119
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
120
		assertEquals("yesy",SD_FooterTextOnSlideInput.getText());
121
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
122
123
		SD_SlideNumAsFooterOnSlide.uncheck();
124
		SD_ApplyToAllButtonOnSlideFooter.click();
125
126
		//save to ppt and reopen
127
		impress.menuItem("File->Save As...").select();
128
		String saveTo = fullPath("temp/" + "gfdd.ppt");
129
		FileUtil.deleteFile(saveTo);
130
		submitSaveDlg(saveTo);	
131
		if (AlienFormatDlg.exists(3))
132
			AlienFormatDlg.ok();
133
		sleep(1);
134
		impress.menuItem("File->Close").select();
135
		sleep(1);
136
137
		openStartcenter();
138
		app.dispatch(".uno:Open");
139
		String openFrom=fullPath("temp/" + "gfdd.ppt");
140
		submitOpenDlg(openFrom);
141
142
		impress.menuItem("View->Header and Footer...").select();
143
		sleep(1);
144
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
145
		//end-save to ppt and reopen
146
147
		//close Header and Footer dialog.
148
		SD_ApplyButtonOnSlideFooter.focus();
149
		typeKeys("<tab>");
150
		typeKeys("<enter>");
151
		//end
152
153
		//save to odp and reopen
154
		impress.menuItem("File->Save As...").select();
155
		String saveTo2 = fullPath("temp/" + "gfdd.odp");
156
		FileUtil.deleteFile(saveTo2);
157
		submitSaveDlg(saveTo2);	
158
		impress.menuItem("File->Close").select();
159
		sleep(1);
160
161
		openStartcenter();
162
		app.dispatch(".uno:Open");
163
		String openFrom2=fullPath("temp/" + "gfdd.odp");
164
		submitOpenDlg(openFrom2);
165
166
		impress.menuItem("View->Header and Footer...").select();
167
		sleep(1);
168
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
169
		//end-save to odp and reopen
170
	}
171
}
(-)src/testcase/sc/validity/AllowWholeNumLessThan.java (-136 lines)
Lines 1-136 Link Here
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.sc.validity;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.io.File;
30
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
35
import org.junit.Before;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.vcl.IDList;
39
import org.openoffice.test.vcl.widgets.VclMessageBox;
40
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
46
public class AllowWholeNumLessThan {
47
	private static IDList idList = new IDList(new File("./ids"));
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
49
	
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
56
	public Log LOG = new Log();
57
	
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	
71
	/**
72
	 * test Allow whole number, less than or equal to in Validity.
73
	 */
74
	@Test
75
	public void testAllowWholeNumLessThan() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
79
		CalcUtil.selectRange("Sheet1.A1:C5");
80
		calc.menuItem("Data->Validity...").select();
81
		sleep(1);
82
		
83
		SC_ValidityCriteriaTabpage.select();
84
		SC_ValidityCriteriaAllowList.select("Whole Numbers");
85
		SC_ValidityDecimalCompareOperator.select("less than or equal");
86
		SC_ValiditySourceInput.setText("100");
87
		SC_ValidityErrorAlertTabPage.select();
88
		SC_ValidityShowErrorMessage.check();
89
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
90
		SC_ValidityErrorMessage.setText("Invalid value");
91
		typeKeys("<tab>");
92
		typeKeys("<enter>");	
93
		sleep(1);
94
				
95
		CalcUtil.selectRange("Sheet1.A1");
96
		SC_CellInput.activate();
97
		typeKeys("99");
98
		typeKeys("<enter>");
99
		assertEquals("99",CalcUtil.getCellText("Sheet1.A1"));
100
		
101
		CalcUtil.selectRange("Sheet1.A2");
102
		SC_CellInput.activate();
103
		typeKeys("100");
104
		typeKeys("<enter>");
105
		assertEquals("100",CalcUtil.getCellText("Sheet1.A2"));
106
						
107
		CalcUtil.selectRange("Sheet1.B1");
108
		SC_CellInput.activate();
109
		typeKeys("101");
110
		typeKeys("<enter>");
111
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
112
		ActiveMsgBox.ok();
113
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
114
115
		CalcUtil.selectRange("Sheet1.B2");
116
		SC_CellInput.activate();
117
		typeKeys("45.5");
118
		typeKeys("<enter>");
119
		sleep(1);
120
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
121
		ActiveMsgBox.ok();
122
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
123
		
124
		CalcUtil.selectRange("Sheet1.C1");
125
		SC_CellInput.activate();
126
		typeKeys("test");
127
		typeKeys("<enter>");
128
		sleep(1);
129
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
130
		ActiveMsgBox.ok();
131
		assertEquals("",CalcUtil.getCellText("Sheet1.C1"));
132
		
133
		}
134
135
}
136
(-)src/testcase/textdocument/table/Table.java (-90 lines)
Lines 1-90 Link Here
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
/**
25
 * 
26
 */
27
package testcase.textdocument.table;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
import static org.junit.Assert.*;
32
import org.junit.After;
33
import org.junit.Before;
34
import org.junit.Rule;
35
import org.junit.Test;
36
import org.openoffice.test.common.SystemUtil;
37
38
import testlib.Log;
39
40
/**
41
 *
42
 */
43
public class Table {
44
45
	@Rule
46
	public Log LOG = new Log();
47
48
	@Before
49
	public void setUp() throws Exception {
50
		app.start();
51
	}
52
53
	@After
54
	public void tearDown() throws Exception {
55
		app.close();
56
	}
57
58
	/**
59
	 * Test convert table to text in text document
60
	 * @throws Exception
61
	 */
62
	@Test
63
	public void testConvertTableToText() throws Exception{
64
65
		//Create a new text document
66
		startcenter.menuItem("File->New->Text Document").select();
67
		sleep(3);
68
69
		// Insert a table and input some data
70
		writer.menuItem("Insert->Table...").select();
71
		writer_InsertTable.ok();
72
		writer.focus();
73
		typeKeys("1<right>2<right>3<right>4");
74
		sleep(1);
75
76
		// Convert table to text
77
		writer.menuItem("Table->Convert->Table to Text...").select();
78
		assertTrue("Convert Table to Text dialog pop up", writer_ConvertTableToTextDlg.exists());
79
		typeKeys("<enter>");
80
		sleep(1);
81
82
		// Verify if text is converted successfully
83
		writer.menuItem("Edit->Select All").select();
84
		app.dispatch(".uno:Copy");
85
		if (SystemUtil.isWindows())
86
			assertEquals("Converted text", "1\t2\r\n3\t4\r\n", app.getClipboard());	// windows�лس�������\r\n
87
		else
88
			assertEquals("Converted text", "1\t2\n3\t4\n", app.getClipboard());
89
	}
90
}
(-)src/testlib/UIMap.java (-25 / +23 lines)
Lines 242-248 Link Here
242
	public static final VclEditBox SD_FooterTextOnSlideInput = editbox("sd:Edit:RID_SD_TABPAGE_HEADERFOOTER:TB_FOOTER_FIXED");
242
	public static final VclEditBox SD_FooterTextOnSlideInput = editbox("sd:Edit:RID_SD_TABPAGE_HEADERFOOTER:TB_FOOTER_FIXED");
243
	public static final VclButton SD_SlideNumAsFooterOnSlide = button("sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_SLIDENUMBER");
243
	public static final VclButton SD_SlideNumAsFooterOnSlide = button("sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_SLIDENUMBER");
244
	public static final VclButton SD_ApplyToAllButtonOnSlideFooter = button("sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLYTOALL");
244
	public static final VclButton SD_ApplyToAllButtonOnSlideFooter = button("sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLYTOALL");
245
//	public static final VclWindow SD_SlidesPanel = window("HID_SD_WIN_DOCUMENT");
246
	public static final VclControl SD_SlidelistInNaviagtor = control("HID_SD_NAVIGATOR_TLB");
245
	public static final VclControl SD_SlidelistInNaviagtor = control("HID_SD_NAVIGATOR_TLB");
247
	public static final VclControl SD_HeaderAndFooterDialog = control("HID_SD_TABPAGE_HEADERFOOTER_SLIDE");
246
	public static final VclControl SD_HeaderAndFooterDialog = control("HID_SD_TABPAGE_HEADERFOOTER_SLIDE");
248
	public static final VclButton SD_ApplyButtonOnSlideFooter = button("sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLY");
247
	public static final VclButton SD_ApplyButtonOnSlideFooter = button("sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLY");
Lines 290-331 Link Here
290
	public static final VclButton SCSubtotalsIncludeFormatsCheckBox = button("sc:CheckBox:RID_SCPAGE_SUBT_OPTIONS:BTN_FORMATS");
289
	public static final VclButton SCSubtotalsIncludeFormatsCheckBox = button("sc:CheckBox:RID_SCPAGE_SUBT_OPTIONS:BTN_FORMATS");
291
	public static final VclButton SCSubtotalsCustomSortOrderCheckBox = button("sc:CheckBox:RID_SCPAGE_SUBT_OPTIONS:BTN_USERDEF");
290
	public static final VclButton SCSubtotalsCustomSortOrderCheckBox = button("sc:CheckBox:RID_SCPAGE_SUBT_OPTIONS:BTN_USERDEF");
292
	public static final VclListBox SCSubtotalsCustomSortListBox = listbox("sc:ListBox:RID_SCPAGE_SUBT_OPTIONS:LB_USERDEF");
291
	public static final VclListBox SCSubtotalsCustomSortListBox = listbox("sc:ListBox:RID_SCPAGE_SUBT_OPTIONS:LB_USERDEF");
293
	public static final VclListBox SC_ValidityCriteriaAllowList = listbox("548277762");
292
	public static final VclListBox SC_ValidityCriteriaAllowList = listbox("sc:ListBox:TP_VALIDATION_VALUES:LB_ALLOW");
294
	public static final VclTabPage SC_ValidityCriteriaTabpage = tabpage("548274176");
293
	public static final VclTabPage SC_ValidityCriteriaTabpage = tabpage("sc:TabPage:TP_VALIDATION_VALUES");
295
	public static final VclButton SC_ValidityAllowBlankCells = button("548275203");
294
	public static final VclButton SC_ValidityAllowBlankCells = button("sc:CheckBox:TP_VALIDATION_VALUES:TSB_ALLOW_BLANKS");
296
	public static final VclButton SC_ValidityShowSelectionList = button("548275227");
295
	public static final VclButton SC_ValidityShowSelectionList = button("sc:CheckBox:TP_VALIDATION_VALUES:CB_SHOWLIST");
297
	public static final VclButton SC_ValiditySortEntriesAscending = button("548275228");
296
	public static final VclButton SC_ValiditySortEntriesAscending = button("sc:CheckBox:TP_VALIDATION_VALUES:CB_SORTLIST");
298
	public static final VclButton SC_ValiditySourcePicker = button("548286040");
297
	public static final VclButton SC_ValiditySourcePicker = button("sc:ImageButton:TP_VALIDATION_VALUES:RB_VALIDITY_REF");
299
	public static final VclTabPage SC_ValidityErrorAlertTabPage = tabpage("548306944");
298
	public static final VclTabPage SC_ValidityErrorAlertTabPage = tabpage("sc:TabPage:TP_VALIDATION_ERROR");
300
	public static final VclButton SC_ValidityShowErrorMessage = button("548308501");
299
	public static final VclButton SC_ValidityShowErrorMessage = button("sc:TriStateBox:TP_VALIDATION_ERROR:TSB_SHOW");
301
	public static final VclListBox SC_ValidityErrorAlertActionList = listbox("548310552");
300
	public static final VclListBox SC_ValidityErrorAlertActionList = listbox("sc:ListBox:TP_VALIDATION_ERROR:LB_ACTION");
302
	public static final VclEditBox SC_ValidityErrorMessageTitle = editbox("548309005");
301
	public static final VclEditBox SC_ValidityErrorMessageTitle = editbox("sc:Edit:TP_VALIDATION_ERROR:EDT_TITLE");
303
	public static final VclEditBox SC_ValidityErrorMessage = editbox("548309529");
302
	public static final VclEditBox SC_ValidityErrorMessage = editbox("sc:MultiLineEdit:TP_VALIDATION_ERROR:EDT_ERROR");
304
	public static final VclButton SC_ValidityErrorBrowseButton = button("548311578");
303
	public static final VclButton SC_ValidityErrorBrowseButton = button("sc:PushButton:TP_VALIDATION_ERROR:BTN_SEARCH");
305
	public static final VclTabPage SCSubTotalsOptionsTabPage = tabpage("SC_HID_SCPAGE_SUBT_OPTIONS");
304
	public static final VclTabPage SCSubTotalsOptionsTabPage = tabpage("SC_HID_SCPAGE_SUBT_OPTIONS");
306
	public static final VclButton SCDeleteCellsDeleteRowsRadioButton = button("sc:RadioButton:RID_SCDLG_DELCELL:BTN_DELROWS");
305
	public static final VclButton SCDeleteCellsDeleteRowsRadioButton = button("sc:RadioButton:RID_SCDLG_DELCELL:BTN_DELROWS");
307
	public static final VclDialog SCDeleteCellsDialog = dialog(".uno:DeleteCell");
306
	public static final VclDialog SCDeleteCellsDialog = dialog(".uno:DeleteCell");
308
	public static final VclTabPage SCSubTotalsGroup2Dialog = tabpage("SC_HID_SCPAGE_SUBT_GROUP2");
307
	public static final VclTabPage SCSubTotalsGroup2Dialog = tabpage("SC_HID_SCPAGE_SUBT_GROUP2");
309
	public static final VclTabPage SCSubTotalsGroup3Dialog = tabpage("SC_HID_SCPAGE_SUBT_GROUP3");
308
	public static final VclTabPage SCSubTotalsGroup3Dialog = tabpage("SC_HID_SCPAGE_SUBT_GROUP3");
310
	public static final VclListBox SCCalcSubTotolsFuncionList = listbox("SC_HID_SC_SUBT_FUNC");
309
	public static final VclListBox SCCalcSubTotolsFuncionList = listbox("SC_HID_SC_SUBT_FUNC");
311
	public static final VclEditBox SC_ValiditySourceInput = editbox("548276231");
310
	public static final VclEditBox SC_ValiditySourceInput = editbox("sc:Edit:TP_VALIDATION_VALUES:EDT_MIN");
312
	public static final VclWindow SC_CellInput = window("58774");
311
	public static final VclListBox SC_ValidityDecimalCompareOperator = listbox("sc:ListBox:TP_VALIDATION_VALUES:LB_VALUE");
313
	public static final VclListBox SC_ValidityDecimalCompareOperator = listbox("548277765");
312
	public static final VclEditBox SC_ValidityMaxValueInput = editbox("sc:Edit:TP_VALIDATION_VALUES:EDT_MAX");
314
	public static final VclEditBox SC_ValidityMaxValueInput = editbox("548276233");
313
	public static final VclEditBox SC_ValidityEntries = editbox("sc:MultiLineEdit:TP_VALIDATION_VALUES:EDT_LIST");
315
	public static final VclEditBox SC_ValidityEntries = editbox("548276765");
314
	public static final VclTabPage SC_ValidityInputHelpTabPage = tabpage("sc:TabPage:TP_VALIDATION_INPUTHELP");
316
	public static final VclTabPage SC_ValidityInputHelpTabPage = tabpage("548290560");
315
	public static final VclButton SC_ValidityInputHelpCheckbox = button("sc:TriStateBox:TP_VALIDATION_INPUTHELP:TSB_HELP");
317
	public static final VclButton SC_ValidityInputHelpCheckbox = button("548292107");
316
	public static final VclEditBox SC_ValidityInputHelpTitle = editbox("sc:Edit:TP_VALIDATION_INPUTHELP:EDT_TITLE");
318
	public static final VclEditBox SC_ValidityInputHelpTitle = editbox("548292621");
317
	public static final VclEditBox SC_ValidityHelpMessage = editbox("sc:MultiLineEdit:TP_VALIDATION_INPUTHELP:EDT_INPUTHELP");
319
	public static final VclEditBox SC_ValidityHelpMessage = editbox("548293135");
318
	public static final VclButton OptionsDlg_SortListsTabCopy = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_COPY");
320
	public static final VclButton OptionsDlg_Copy = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_COPY");
321
	public static final VclButton SortOptionsPage_RangeContainsColumnLabels = button("sc:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_LABEL");
319
	public static final VclButton SortOptionsPage_RangeContainsColumnLabels = button("sc:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_LABEL");
322
	public static final VclButton SortOptionsPage_CustomSortOrder = button("sc:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_SORT_USER");
320
	public static final VclButton SortOptionsPage_CustomSortOrder = button("sc:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_SORT_USER");
323
	public static final VclButton SortOptionsPage_IncludeFormats = button("sc:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_FORMATS");
321
	public static final VclButton SortOptionsPage_IncludeFormats = button("sc:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_FORMATS");
324
	public static final VclListBox SortOptionsPage_CustomSortOrderList = listbox("sc:ListBox:RID_SCPAGE_SORT_OPTIONS:LB_SORT_USER");
322
	public static final VclListBox SortOptionsPage_CustomSortOrderList = listbox("sc:ListBox:RID_SCPAGE_SORT_OPTIONS:LB_SORT_USER");
325
	public static final VclButton SortOptionsPage_TopToBottom = button("sc:RadioButton:RID_SCPAGE_SORT_OPTIONS:BTN_TOP_DOWN");
323
	public static final VclButton SortOptionsPage_TopToBottom = button("sc:RadioButton:RID_SCPAGE_SORT_OPTIONS:BTN_TOP_DOWN");
326
	public static final VclButton SortOptionsPage_LeftToRight = button("sc:RadioButton:RID_SCPAGE_SORT_OPTIONS:BTN_LEFT_RIGHT");
324
	public static final VclButton SortOptionsPage_LeftToRight = button("sc:RadioButton:RID_SCPAGE_SORT_OPTIONS:BTN_LEFT_RIGHT");
327
	public static final VclButton OptionsDlg_New = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_NEW");
325
	public static final VclButton OptionsDlg_SortListsTabNew = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_NEW");
328
	public static final VclButton OptionsDlg_Add = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_ADD");
326
	public static final VclButton OptionsDlg_SortListsTabAdd = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_ADD");
329
	public static final VclTabPage FormatCellsDlg_NumbersPage = tabpage("CUI_HID_NUMBERFORMAT");
327
	public static final VclTabPage FormatCellsDlg_NumbersPage = tabpage("CUI_HID_NUMBERFORMAT");
330
	public static final VclListBox FormatCellsDlg_NumbersPageCategory = listbox("cui:ListBox:RID_SVXPAGE_NUMBERFORMAT:LB_CATEGORY");
328
	public static final VclListBox FormatCellsDlg_NumbersPageCategory = listbox("cui:ListBox:RID_SVXPAGE_NUMBERFORMAT:LB_CATEGORY");
331
	public static final VclListBox FormatCellsDlg_NumbersPageCurrencyFormat = listbox("cui:ListBox:RID_SVXPAGE_NUMBERFORMAT:LB_CURRENCY");
329
	public static final VclListBox FormatCellsDlg_NumbersPageCurrencyFormat = listbox("cui:ListBox:RID_SVXPAGE_NUMBERFORMAT:LB_CURRENCY");
(-)src/testcase/sc/datapilot/CopyPasteDataPilotTable.java (-153 lines)
Lines 1-153 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
/**
48
 * 
49
 *
50
 */
51
public class CopyPasteDataPilotTable {
52
	/**
53
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
54
	 * Collect extra data when OpenOffice crashes.
55
	 */
56
	@Rule
57
	public Log LOG = new Log();
58
59
	/**
60
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
61
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
62
	 * Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	/**
71
	 * 
72
	 * Verify copy and paste Data Pilot Table
73
	 */
74
	@Test
75
	public void test() {
76
		//Open the sample file
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		
82
		//Create DataPilotTable and verify the content
83
		CalcUtil.selectRange("A1:E27");
84
		calc.menuItem("Data->DataPilot->Start...").select();		
85
		CreateDataPilotTableDialog.ok();
86
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
87
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
88
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
89
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
90
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
91
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
92
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
93
		
94
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
95
			DataPilotAutomaticallyUpdateCheckBox.check();
96
		}
97
		
98
		//Add field into every area
99
		DataPilotFieldSelect.click(1, 1);
100
		DataPilotFieldSelect.openContextMenu();
101
		menuItem("Add to Page").select();
102
		assertEquals("Locale",CalcUtil.getCellText("A1"));
103
		sleep(1);
104
		
105
		DataPilotFieldSelect.click(1,30);
106
		DataPilotFieldSelect.openContextMenu();
107
		menuItem("Add to Column").select();
108
		assertEquals("Name",CalcUtil.getCellText("A3"));
109
		sleep(1);
110
		
111
		DataPilotFieldSelect.click(1,50);
112
		DataPilotFieldSelect.openContextMenu();
113
		menuItem("Add to Row").select();
114
		assertEquals("Date",CalcUtil.getCellText("A4"));
115
		sleep(1);
116
		
117
		DataPilotFieldSelect.click(1,70);
118
		DataPilotFieldSelect.openContextMenu();
119
		menuItem("Add to Data by->Sum").select();
120
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
121
		assertEquals("266773",CalcUtil.getCellText("J23"));
122
		sleep(1);
123
		
124
		//Copy and paste the data pilot table and verify the content
125
		CalcUtil.selectRange("A1:J24");
126
		typeKeys("<$copy>");
127
		
128
		CalcUtil.selectRange("A26");
129
		typeKeys("<$paste>");
130
		assertEquals("Locale",CalcUtil.getCellText("A26"));
131
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
132
		assertEquals("Name",CalcUtil.getCellText("B28"));
133
		assertEquals("Date",CalcUtil.getCellText("A29"));
134
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
135
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
136
		assertEquals("266773",CalcUtil.getCellText("J48"));
137
		sleep(1);
138
		
139
		CalcUtil.selectRange("A1:J24");
140
		typeKeys("<$copy>");
141
		CalcUtil.selectRange("$A.$A29");
142
		typeKeys("<$paste>");
143
		assertEquals("Locale",CalcUtil.getCellText("A29"));
144
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A31"));
145
		assertEquals("Name",CalcUtil.getCellText("B31"));
146
		assertEquals("Date",CalcUtil.getCellText("A32"));
147
		assertEquals("Total Result",CalcUtil.getCellText("A51"));
148
		assertEquals("Total Result",CalcUtil.getCellText("J32"));
149
		assertEquals("266773",CalcUtil.getCellText("J51"));
150
		
151
	}
152
153
}
(-)src/testcase/sc/validity/AllowGreaterTextLength.java (-126 lines)
Lines 1-126 Link Here
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.sc.validity;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.io.File;
30
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
35
import org.junit.Before;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.vcl.IDList;
39
import org.openoffice.test.vcl.widgets.VclMessageBox;
40
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
46
public class AllowGreaterTextLength {
47
	private static IDList idList = new IDList(new File("./ids"));
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
49
	
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
56
	public Log LOG = new Log();
57
	
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	
71
	/**
72
	 * test Allow Text length,  greater than or equal to  in Validity.
73
	 */
74
	@Test
75
	public void testAllowDecimalEqual() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
79
		CalcUtil.selectRange("Sheet1.A1:B5");
80
		calc.menuItem("Data->Validity...").select();
81
		sleep(1);
82
		
83
		SC_ValidityCriteriaTabpage.select();
84
		SC_ValidityCriteriaAllowList.select("Text length");
85
		SC_ValidityDecimalCompareOperator.select("greater than or equal to");
86
		SC_ValiditySourceInput.setText("10");
87
		SC_ValidityErrorAlertTabPage.select();
88
		SC_ValidityShowErrorMessage.check();
89
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
90
		SC_ValidityErrorMessage.setText("Invalid value");
91
		typeKeys("<tab>");
92
		typeKeys("<enter>");	
93
		sleep(1);
94
				
95
		CalcUtil.selectRange("Sheet1.A1");
96
		SC_CellInput.activate();
97
		typeKeys("testtesttesttest");
98
		typeKeys("<enter>");
99
		assertEquals("Testtesttesttest",CalcUtil.getCellText("Sheet1.A1"));
100
		
101
		CalcUtil.selectRange("Sheet1.A2");
102
		SC_CellInput.activate();
103
		typeKeys("test test ");
104
		typeKeys("<enter>");
105
		assertEquals("Test test ",CalcUtil.getCellText("Sheet1.A2"));
106
		
107
		CalcUtil.selectRange("Sheet1.A4");
108
		SC_CellInput.activate();
109
		typeKeys(" ");
110
		typeKeys("<enter>");
111
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
112
		ActiveMsgBox.ok();
113
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
114
115
		CalcUtil.selectRange("Sheet1.A3");
116
		SC_CellInput.activate();
117
		typeKeys("Testatest");
118
		typeKeys("<enter>");
119
		sleep(1);
120
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
121
		ActiveMsgBox.ok();
122
		assertEquals("",CalcUtil.getCellText("Sheet1.A3"));
123
		}
124
125
}
126
(-)src/testcase/presentation/headerandfooter/HeaderAndFooterSetting.java (-724 lines)
Lines 1-724 Link Here
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
/**
25
 * 
26
 */
27
package testcase.presentation.headerandfooter;
28
29
import static testlib.AppUtil.fullPath;
30
import static testlib.AppUtil.openStartcenter;
31
import static testlib.AppUtil.submitOpenDlg;
32
import static testlib.AppUtil.submitSaveDlg;
33
import static testlib.UIMap.*;
34
import static org.junit.Assert.*;
35
import static org.openoffice.test.vcl.Tester.*;
36
import org.junit.After;
37
import org.junit.Before;
38
import org.junit.Rule;
39
import org.junit.Test;
40
import org.openoffice.test.common.FileUtil;
41
import testlib.ImpressUtil;
42
import testlib.Log;
43
44
public class HeaderAndFooterSetting{
45
46
	@Rule
47
	public Log LOG = new Log();
48
49
	@Before
50
	public void setUp() throws Exception {
51
		app.start();
52
53
		// New a impress, insert some slides
54
		app.dispatch("private:factory/simpress?slot=6686");
55
		PresentationWizard.ok();
56
		sleep(1);
57
58
		for(int i=0; i<5;i++){
59
			SD_InsertPageButtonOnToolbar.click();
60
			sleep(1);
61
		}
62
		// Pop up navigator panel
63
		impress.menuItem("View").select();
64
		if(!impress.menuItem("View->Navigator").isSelected()){
65
			impress.menuItem("View->Navigator").select();
66
		}
67
	}
68
69
	@After
70
	public void tearDown() throws Exception {
71
		app.close();
72
	}
73
74
	/**
75
	 * Test Copy slide with Apply Footer to same file and different file
76
	 * @throws Exception
77
	 */
78
	@Test
79
	public void testCopySlideWithApplyFooter() throws Exception{
80
81
		//add header and footer
82
		impress.menuItem("View->Header and Footer...").select();
83
		sleep(2);
84
85
		SD_DateAndTimeFooterOnSlide.check();
86
		SD_FixedDateAndTimeFooterOnSlide.check();
87
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
88
		SD_FooterTextOnSlide.check();
89
		SD_FooterTextOnSlideInput.setText("Footer Test");
90
		SD_SlideNumAsFooterOnSlide.check();
91
		SD_ApplyToAllButtonOnSlideFooter.click();
92
		sleep(1);
93
94
		ImpressSlideSorter.focus();
95
		for(int j=0; j<=2;j++){
96
			typeKeys("<up>");
97
		}
98
		impress.menuItem("View->Header and Footer...").select();
99
		sleep(1);
100
		SD_SlideNumAsFooterOnSlide.uncheck();
101
		SD_ApplyButtonOnSlideFooter.click();
102
103
		//paste to the same file
104
		ImpressSlideSorter.focus();
105
		app.dispatch(".uno:Copy");
106
		app.dispatch(".uno:Paste");
107
108
		impress.menuItem("View->Header and Footer...").select();
109
		sleep(1);
110
		assertEquals("Fix Date: 20120323", SD_FixedDateAndTimeOnSlideInput.getText());
111
		assertEquals("Footer Test", SD_FooterTextOnSlideInput.getText());
112
		assertEquals(false, SD_SlideNumAsFooterOnSlide.isChecked());
113
114
		//close header and footer dialog.
115
		SD_ApplyButtonOnSlideFooter.focus();
116
		typeKeys("<tab>");
117
		typeKeys("<enter>");
118
119
		//paste to different file
120
		impress.focus();
121
		app.dispatch("private:factory/simpress?slot=6686");
122
		PresentationWizard.ok();
123
		sleep(1);
124
		app.dispatch(".uno:Paste");
125
		ImpressSlideSorter.focus();
126
		typeKeys("<down>");
127
		sleep(1);
128
129
		impress.menuItem("View->Header and Footer...").select();
130
		sleep(1);
131
		assertEquals("Fix Date: 20120323", SD_FixedDateAndTimeOnSlideInput.getText());
132
		assertEquals("Footer Test", SD_FooterTextOnSlideInput.getText());
133
		assertEquals(false, SD_SlideNumAsFooterOnSlide.isChecked());
134
	}
135
136
	/**
137
	 * Test Copy slide with Apply to all Footer to same file and different file
138
	 * @throws Exception
139
	 */
140
	@Test
141
	public void testCopySlideWithApplyToAllFooter() throws Exception{
142
143
		//add header and footer
144
		impress.menuItem("View->Header and Footer...").select();
145
		sleep(2);
146
147
		SD_DateAndTimeFooterOnSlide.check();
148
		SD_FixedDateAndTimeFooterOnSlide.check();
149
		sleep(1);
150
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
151
		sleep(1);
152
		SD_FooterTextOnSlide.check();
153
		sleep(1);
154
		SD_FooterTextOnSlideInput.setText("Footer Test");
155
		sleep(1);
156
		SD_SlideNumAsFooterOnSlide.check();
157
		sleep(1);
158
		SD_ApplyToAllButtonOnSlideFooter.click();
159
		sleep(1);
160
161
		ImpressSlideSorter.focus();
162
		for(int j=0; j<=2;j++){
163
			typeKeys("<up>");
164
			sleep(1);
165
		}
166
		impress.menuItem("View->Header and Footer...").select();
167
		sleep(1);
168
		SD_SlideNumAsFooterOnSlide.uncheck();
169
		SD_ApplyButtonOnSlideFooter.click();
170
171
		//paste to the same file
172
		ImpressSlideSorter.focus();
173
		typeKeys("<up>");
174
		app.dispatch(".uno:Copy");
175
		typeKeys("<down>");
176
		sleep(1);
177
		app.dispatch(".uno:Paste");
178
179
		impress.menuItem("View->Header and Footer...").select();
180
		sleep(1);
181
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
182
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
183
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
184
185
		//close header and footer dialog.
186
		SD_ApplyButtonOnSlideFooter.focus();
187
		typeKeys("<tab>");
188
		typeKeys("<enter>");
189
190
		//paste to different file
191
		impress.focus();
192
		impress.menuItem("File->New->Presentation").select();
193
		sleep(1);
194
		app.dispatch(".uno:Paste");
195
		ImpressSlideSorter.focus();
196
		typeKeys("<down>");
197
		sleep(1);
198
199
		impress.menuItem("View->Header and Footer...").select();
200
		sleep(1);
201
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
202
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
203
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
204
	}
205
206
	/**
207
	 * Test Copy slide with Notes Footer to same file and different file
208
	 * @throws Exception
209
	 */
210
	@Test
211
	public void testCopySlideWithNotesHeaderFooter() throws Exception{
212
213
		//add header and footer
214
		impress.menuItem("View->Header and Footer...").select();
215
		sleep(1);
216
		SD_HeaderAndFooterOnNotesTabPage.select();
217
		SD_HeaderTextOnNotes.check();
218
		SD_HeaderTextOnNotesInput.setText("Header Test");
219
		SD_DateAndTimeFooterOnSlide.check();
220
		SD_FixedDateAndTimeFooterOnSlide.check();
221
		sleep(1);
222
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
223
		sleep(1);
224
		SD_FooterTextOnSlide.check();
225
		sleep(1);
226
		SD_FooterTextOnSlideInput.setText("Footer Test");
227
		sleep(1);
228
		SD_SlideNumAsFooterOnSlide.check();
229
		sleep(1);
230
		SD_ApplyToAllButtonOnSlideFooter.click();
231
		sleep(1);
232
233
		//paste to the same file
234
		ImpressSlideSorter.focus();
235
		typeKeys("<up>");
236
		app.dispatch(".uno:Copy");
237
		typeKeys("<down>");
238
		sleep(1);
239
		app.dispatch(".uno:Paste");
240
241
		ImpressUtil.getCurView().activate();
242
243
		impress.menuItem("View->Header and Footer...").select();
244
		sleep(1);
245
		SD_HeaderAndFooterOnNotesTabPage.select();
246
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
247
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
248
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
249
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
250
251
		//close header and footer dialog.
252
		SD_ApplyToAllButtonOnSlideFooter.focus();
253
		typeKeys("<tab>");
254
		typeKeys("<enter>");
255
256
		//paste to different file
257
		impress.focus();
258
		impress.menuItem("File->New->Presentation").select();
259
		sleep(1);
260
		app.dispatch(".uno:Paste");
261
		ImpressSlideSorter.focus();
262
		typeKeys("<down>");
263
		sleep(1);
264
		ImpressUtil.getCurView().activate();
265
		impress.menuItem("View->Header and Footer...").select();
266
		sleep(1);
267
		SD_HeaderAndFooterOnNotesTabPage.select();
268
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
269
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
270
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
271
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
272
	}
273
274
	/**
275
	 * Test duplicate slide with Apply to all Footer to same file 
276
	 * @throws Exception
277
	 */
278
	@Test
279
	public void testDuplicateSlideWithApplyToAllFooter() throws Exception{
280
281
		//add header and footer
282
		impress.menuItem("View->Header and Footer...").select();
283
		sleep(2);
284
285
		SD_DateAndTimeFooterOnSlide.check();
286
		SD_FixedDateAndTimeFooterOnSlide.check();
287
		sleep(1);
288
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
289
		sleep(1);
290
		SD_FooterTextOnSlide.check();
291
		sleep(1);
292
		SD_FooterTextOnSlideInput.setText("Footer Test");
293
		sleep(1);
294
		SD_SlideNumAsFooterOnSlide.check();
295
		sleep(1);
296
		SD_ApplyToAllButtonOnSlideFooter.click();
297
		sleep(1);
298
299
300
		ImpressSlideSorter.focus();
301
		for(int j=0; j<=2;j++){
302
			typeKeys("<up>");
303
			sleep(1);
304
		}
305
		impress.menuItem("Insert->Duplicate Slide").select();
306
		impress.menuItem("View->Header and Footer...").select();
307
		sleep(1);
308
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
309
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
310
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
311
	}
312
313
	/**
314
	 * Test footer not show on the first slide. 
315
	 * @throws Exception
316
	 */
317
	@Test
318
	public void testFooterNotShowOn1stSlide() throws Exception{
319
320
		//add header and footer
321
		impress.menuItem("View->Header and Footer...").select();
322
		sleep(2);
323
		SD_FooterTextOnSlide.check();
324
		sleep(1);
325
		SD_FooterTextOnSlideInput.setText("Footer Test");
326
		sleep(1);
327
		SD_FooterNotShowOn1stSlide.check();
328
		SD_ApplyToAllButtonOnSlideFooter.click();
329
		sleep(1);
330
331
		ImpressSlideSorter.focus();
332
		for(int j=0; j<5; j++){
333
			typeKeys("<up>");
334
		}
335
336
		impress.menuItem("View->Header and Footer...").select();
337
		sleep(1);
338
		assertEquals(true,SD_FooterNotShowOn1stSlide.isChecked());
339
		assertEquals(false,SD_FooterTextOnSlide.isChecked());
340
	}
341
342
	/**
343
	 * Test Insert Footer to focus slide.
344
	 * @throws Exception
345
	 */
346
	@Test
347
	public void testInsertApplyFooterOnSlide() throws Exception{
348
349
		//add header and footer to focus slide.
350
		impress.menuItem("View->Header and Footer...").select();
351
		sleep(2);
352
353
		SD_DateAndTimeFooterOnSlide.check();
354
		SD_FixedDateAndTimeFooterOnSlide.check();
355
		sleep(1);
356
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
357
		sleep(1);
358
		SD_FooterTextOnSlide.check();
359
		sleep(1);
360
		SD_FooterTextOnSlideInput.setText("Footer Test");
361
		sleep(1);
362
		SD_SlideNumAsFooterOnSlide.check();
363
		sleep(1);
364
		SD_ApplyButtonOnSlideFooter.click();
365
		sleep(1);
366
367
		impress.menuItem("View->Header and Footer...").select();
368
		sleep(1);
369
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
370
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
371
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
372
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
373
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
374
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
375
		//close header and footer dialog.
376
		SD_ApplyButtonOnSlideFooter.focus();
377
		typeKeys("<tab>");
378
		typeKeys("<enter>");
379
		//end close
380
381
		ImpressSlideSorter.focus();
382
		typeKeys("<up>");
383
384
		impress.menuItem("View->Header and Footer...").select();
385
		sleep(1);
386
		assertEquals("",SD_FixedDateAndTimeOnSlideInput.getText());
387
		assertEquals("",SD_FooterTextOnSlideInput.getText());
388
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
389
		//close header and footer dialog.
390
		SD_ApplyButtonOnSlideFooter.focus();
391
		typeKeys("<tab>");
392
		typeKeys("<enter>");
393
		//end close
394
395
		SD_InsertPageButtonOnToolbar.click();
396
		impress.menuItem("View->Header and Footer...").select();
397
		sleep(1);
398
		assertEquals("",SD_FixedDateAndTimeOnSlideInput.getText());
399
		assertEquals("",SD_FooterTextOnSlideInput.getText());
400
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
401
	}
402
403
	/**
404
	 * Test Insert Footer to Notes View
405
	 * @throws Exception
406
	 */
407
	@Test
408
	public void testInsertApplyToAllFooterOnNotes() throws Exception{
409
410
		//add header and footer to focus slide.
411
		impress.menuItem("View->Header and Footer...").select();
412
		sleep(1);
413
		SD_HeaderAndFooterOnNotesTabPage.select();
414
		SD_HeaderTextOnNotes.check();
415
		SD_HeaderTextOnNotesInput.setText("Header Test");
416
		SD_DateAndTimeFooterOnSlide.check();
417
		SD_FixedDateAndTimeFooterOnSlide.check();
418
		sleep(1);
419
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
420
		sleep(1);
421
		SD_FooterTextOnSlide.check();
422
		sleep(1);
423
		SD_FooterTextOnSlideInput.setText("Footer Test");
424
		sleep(1);
425
		SD_SlideNumAsFooterOnSlide.check();
426
		sleep(1);
427
		SD_ApplyToAllButtonOnSlideFooter.click();
428
		sleep(1);
429
430
		impress.menuItem("View->Header and Footer...").select();
431
		sleep(1);
432
		SD_HeaderAndFooterOnNotesTabPage.select();
433
		assertEquals(true,SD_HeaderTextOnNotes.isChecked());
434
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
435
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
436
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
437
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
438
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
439
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
440
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
441
		//close header and footer dialog.
442
		SD_ApplyToAllButtonOnSlideFooter.focus();
443
		typeKeys("<tab>");
444
		typeKeys("<enter>");
445
		//end close
446
447
		ImpressSlideSorter.focus();
448
		typeKeys("<up>");
449
450
		impress.menuItem("View->Header and Footer...").select();
451
		sleep(1);
452
		SD_HeaderAndFooterOnNotesTabPage.select();
453
		assertEquals(true,SD_HeaderTextOnNotes.isChecked());
454
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
455
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
456
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
457
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
458
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
459
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
460
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
461
		//close header and footer dialog.
462
		SD_ApplyToAllButtonOnSlideFooter.focus();
463
		typeKeys("<tab>");
464
		typeKeys("<enter>");
465
		//end close
466
467
		SD_InsertPageButtonOnToolbar.click();
468
		impress.menuItem("View->Header and Footer...").select();
469
		sleep(1);
470
		SD_HeaderAndFooterOnNotesTabPage.select();
471
		assertEquals(true,SD_HeaderTextOnNotes.isChecked());
472
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
473
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
474
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
475
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
476
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
477
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
478
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
479
	}
480
481
	/**
482
	 * Test Insert Footer to Slide, use Apply to All
483
	 * @throws Exception
484
	 */
485
	@Test
486
	public void testInsertApplyToAllFooterOnSlide() throws Exception{
487
488
		//add header and footer to focus slide.
489
		impress.menuItem("View->Header and Footer...").select();
490
		sleep(2);
491
492
		SD_DateAndTimeFooterOnSlide.check();
493
		SD_FixedDateAndTimeFooterOnSlide.check();
494
		sleep(1);
495
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
496
		sleep(1);
497
		SD_FooterTextOnSlide.check();
498
		sleep(1);
499
		SD_FooterTextOnSlideInput.setText("Footer Test");
500
		sleep(1);
501
		SD_SlideNumAsFooterOnSlide.check();
502
		sleep(1);
503
		SD_ApplyToAllButtonOnSlideFooter.click();
504
		sleep(1);
505
506
		impress.menuItem("View->Header and Footer...").select();
507
		sleep(1);
508
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
509
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
510
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
511
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
512
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
513
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
514
		//close header and footer dialog.
515
		SD_ApplyButtonOnSlideFooter.focus();
516
		typeKeys("<tab>");
517
		typeKeys("<enter>");
518
		//end close
519
520
		ImpressSlideSorter.focus();
521
		typeKeys("<up>");
522
523
		impress.menuItem("View->Header and Footer...").select();
524
		sleep(1);
525
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
526
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
527
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
528
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
529
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
530
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
531
		//close header and footer dialog.
532
		SD_ApplyButtonOnSlideFooter.focus();
533
		typeKeys("<tab>");
534
		typeKeys("<enter>");
535
		//end close
536
537
		SD_InsertPageButtonOnToolbar.click();
538
		impress.menuItem("View->Header and Footer...").select();
539
		sleep(1);
540
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
541
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
542
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
543
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
544
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
545
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
546
	}
547
548
	/**
549
	 * Test Insert update automatically time footer to slides.
550
	 * @throws Exception
551
	 */
552
	@Test
553
	public void testInsertAutoUpdateTimeFooter() throws Exception{
554
555
		//add header and footer
556
		impress.menuItem("View->Header and Footer...").select();
557
		sleep(1);
558
		SD_AutoUpdateTimeFooter.check();
559
		SD_AutoUpdateTimeFooterType.select(7);
560
		String currentTime=SD_AutoUpdateTimeFooterType.getItemText(7);
561
		SD_ApplyToAllButtonOnSlideFooter.click();
562
		sleep(2);
563
564
		impress.menuItem("View->Header and Footer...").select();
565
		sleep(1);
566
567
		String currentTime2=SD_AutoUpdateTimeFooterType.getItemText(7);
568
		assertFalse(currentTime.equals(currentTime2));
569
	}
570
571
	/**
572
	 * Test Insert update automatically time footer to Notes view.
573
	 * @throws Exception
574
	 */
575
	@Test
576
	public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception{
577
578
		//add header and footer
579
		impress.menuItem("View->Header and Footer...").select();
580
		sleep(1);
581
		SD_HeaderAndFooterOnNotesTabPage.select();
582
		SD_AutoUpdateTimeFooter.check();
583
		SD_AutoUpdateTimeFooterType.select(7);
584
		String currentTime=SD_AutoUpdateTimeFooterType.getItemText(7);
585
		SD_ApplyToAllButtonOnSlideFooter.click();
586
		sleep(2);
587
588
		impress.menuItem("View->Header and Footer...").select();
589
		sleep(1);
590
		SD_HeaderAndFooterOnNotesTabPage.select();
591
		String currentTime2=SD_AutoUpdateTimeFooterType.getItemText(7);
592
593
		assertFalse(currentTime.equals(currentTime2));
594
	}
595
596
	/**
597
	 * Test Insert Header and Footer to Notes view.
598
	 * Save and ReOpen
599
	 * @throws Exception
600
	 */
601
	@Test
602
	public void testInsertHeaderFooterOnNotes() throws Exception{
603
604
		//add header and footer
605
		impress.menuItem("View->Header and Footer...").select();
606
		sleep(1);
607
		SD_HeaderAndFooterOnNotesTabPage.select();
608
		SD_HeaderTextOnNotes.check();
609
		SD_HeaderTextOnNotesInput.setText("Header Test");
610
		SD_DateAndTimeFooterOnSlide.check();
611
		SD_FixedDateAndTimeFooterOnSlide.check();
612
		sleep(1);
613
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
614
		sleep(1);
615
		SD_FooterTextOnSlide.check();
616
		sleep(1);
617
		SD_FooterTextOnSlideInput.setText("Footer Test");
618
		sleep(1);
619
		SD_SlideNumAsFooterOnSlide.check();
620
		sleep(1);
621
		SD_ApplyToAllButtonOnSlideFooter.click();
622
		sleep(1);
623
624
		ImpressSlideSorter.focus();
625
		typeKeys("<up>");
626
627
		impress.menuItem("View->Header and Footer...").select();
628
		sleep(1);
629
		SD_HeaderAndFooterOnNotesTabPage.select();
630
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
631
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
632
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
633
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
634
635
		//close header and footer dialog.
636
		SD_ApplyToAllButtonOnSlideFooter.focus();
637
		typeKeys("<tab>");
638
		typeKeys("<enter>");
639
640
		//save this file
641
		impress.menuItem("File->Save").select();
642
		String saveTo = fullPath("temp/" + "hello.odp");
643
		FileUtil.deleteFile(saveTo);
644
		submitSaveDlg(saveTo);	
645
		impress.menuItem("File->Close").select();
646
		sleep(2);
647
648
		//Reopen this file
649
		openStartcenter();
650
		app.dispatch(".uno:Open");
651
		String openFrom=fullPath("temp/" + "hello.odp");
652
		submitOpenDlg(openFrom);
653
654
		//check after reopen		
655
		impress.menuItem("View->Header and Footer...").select();
656
		sleep(1);
657
		SD_HeaderAndFooterOnNotesTabPage.select();
658
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
659
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
660
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
661
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
662
	}
663
664
	/**
665
	 * Test Insert Header and Footer to Slide
666
	 * Save and Reopen
667
	 * @throws Exception
668
	 */
669
	@Test
670
	public void testInsertHeaderFooterOnSlide() throws Exception{
671
672
		//add header and footer
673
		impress.menuItem("View->Header and Footer...").select();
674
		sleep(1);
675
		SD_DateAndTimeFooterOnSlide.check();
676
		SD_FixedDateAndTimeFooterOnSlide.check();
677
		sleep(1);
678
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
679
		sleep(1);
680
		SD_FooterTextOnSlide.check();
681
		sleep(1);
682
		SD_FooterTextOnSlideInput.setText("Footer Test");
683
		sleep(1);
684
		SD_SlideNumAsFooterOnSlide.check();
685
		sleep(1);
686
		SD_ApplyToAllButtonOnSlideFooter.click();
687
		sleep(1);
688
689
		ImpressSlideSorter.focus();
690
		typeKeys("<up>");
691
692
		impress.menuItem("View->Header and Footer...").select();
693
		sleep(1);
694
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
695
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
696
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
697
698
		//close header and footer dialog.
699
		SD_ApplyButtonOnSlideFooter.focus();
700
		typeKeys("<tab>");
701
		typeKeys("<enter>");
702
703
		//save this file
704
		impress.menuItem("File->Save").select();
705
		String saveTo = fullPath("temp/" + "hello.odp");
706
		FileUtil.deleteFile(saveTo);
707
		submitSaveDlg(saveTo);	
708
		impress.menuItem("File->Close").select();
709
		sleep(2);
710
711
		//Reopen this file
712
		openStartcenter();
713
		app.dispatch(".uno:Open");
714
		String openFrom=fullPath("temp/" + "hello.odp");
715
		submitOpenDlg(openFrom);
716
717
		//check after reopen		
718
		impress.menuItem("View->Header and Footer...").select();
719
		sleep(1);
720
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
721
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
722
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
723
	}
724
}
(-)src/testcase/sc/validity/AllowTimeGreaterThan.java (-123 lines)
Lines 1-123 Link Here
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.sc.validity;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.io.File;
30
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
35
import org.junit.Before;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.vcl.IDList;
39
import org.openoffice.test.vcl.widgets.VclMessageBox;
40
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
46
public class AllowTimeGreaterThan {
47
	private static IDList idList = new IDList(new File("./ids"));
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
49
	
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
56
	public Log LOG = new Log();
57
	
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	
71
	/**
72
	 * test Allow time Greater than and equal to  in Validity.
73
	 */
74
	@Test
75
	public void testAllowTimeGreaterThan() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
79
		CalcUtil.selectRange("Sheet1.A1:C5");
80
		calc.menuItem("Data->Validity...").select();
81
		sleep(1);
82
		
83
		SC_ValidityCriteriaTabpage.select();
84
		SC_ValidityCriteriaAllowList.select("Time");
85
		SC_ValidityDecimalCompareOperator.select("greater than or equal to");
86
		SC_ValiditySourceInput.setText("8:00");
87
88
		SC_ValidityErrorAlertTabPage.select();
89
		SC_ValidityShowErrorMessage.check();
90
		SC_ValidityErrorAlertActionList.select("Warning");
91
		
92
		SC_ValidityErrorMessageTitle.setText("warning to enter");
93
		SC_ValidityErrorMessage.setText("Invalid value");
94
		typeKeys("<tab>");
95
		typeKeys("<enter>");	
96
		sleep(1);
97
				
98
		CalcUtil.selectRange("Sheet1.A1");
99
		SC_CellInput.activate();
100
		typeKeys("7:30");
101
		typeKeys("<enter>");
102
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
103
		ActiveMsgBox.ok();
104
		assertEquals("07:30:00 AM",CalcUtil.getCellText("Sheet1.A1"));
105
		
106
		CalcUtil.selectRange("Sheet1.A2");
107
		SC_CellInput.activate();
108
		typeKeys("6:00");
109
		typeKeys("<enter>");
110
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
111
		ActiveMsgBox.cancel();
112
		assertEquals("",CalcUtil.getCellText("Sheet1.A2"));
113
		
114
		CalcUtil.selectRange("Sheet1.A3");
115
		SC_CellInput.activate();
116
		typeKeys("8:00");
117
		typeKeys("<enter>");
118
		assertEquals("08:00:00 AM",CalcUtil.getCellText("Sheet1.A3"));
119
		
120
		}
121
122
}
123
(-)src/testcase/sc/validity/UncheckErrorAlert.java (-105 lines)
Lines 1-105 Link Here
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.sc.validity;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.io.File;
30
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
35
import org.junit.Before;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.vcl.IDList;
39
import org.openoffice.test.vcl.widgets.VclMessageBox;
40
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
46
public class UncheckErrorAlert {
47
	private static IDList idList = new IDList(new File("./ids"));
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
49
	
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
56
	public Log LOG = new Log();
57
	
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	
71
	/**
72
	 * test uncheck Error Alert in Validity.
73
	 */
74
	@Test
75
	public void testUncheckErrorAlert() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
79
		CalcUtil.selectRange("Sheet1.A1:B5");
80
		calc.menuItem("Data->Validity...").select();
81
		sleep(1);
82
		
83
		SC_ValidityCriteriaTabpage.select();
84
		SC_ValidityCriteriaAllowList.select("Decimal");
85
		SC_ValidityDecimalCompareOperator.select("equal");
86
		SC_ValiditySourceInput.setText("1");
87
						
88
		SC_ValidityErrorAlertTabPage.select();
89
		SC_ValidityShowErrorMessage.uncheck();
90
		SC_ValidityErrorAlertActionList.select("Stop");
91
		typeKeys("<enter>");	
92
		sleep(1);
93
				
94
		
95
		CalcUtil.selectRange("Sheet1.A1");
96
		SC_CellInput.activate();
97
		typeKeys("13");
98
		typeKeys("<enter>");
99
		assertEquals("13",CalcUtil.getCellText("Sheet1.A1"));
100
		
101
		}
102
103
}
104
105
(-)src/testcase/sc/datapilot/DataPilotChangeDataFieldOptionAutoUpdate.java (-198 lines)
Lines 1-198 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 * 
50
 *
51
 */
52
public class DataPilotChangeDataFieldOptionAutoUpdate {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while add fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		//open the sample file Create DataPilotTable and verify the content
78
		String file = testFile("source_data01.ods");
79
		startcenter.menuItem("File->Open...").select();
80
		submitOpenDlg(file);
81
		sleep(2);
82
		CalcUtil.selectRange("A1:E27");
83
		calc.menuItem("Data->DataPilot->Start...").select();
84
		CreateDataPilotTableDialog.ok();
85
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
86
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
87
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
88
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
89
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
90
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
91
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
			
95
		}
96
		sleep(1);
97
		
98
		DataPilotFieldSelect.click(1, 1);
99
		DataPilotFieldSelect.openContextMenu();
100
		menuItem("Add to Column").select();
101
		assertEquals("Locale",CalcUtil.getCellText("A1"));
102
		sleep(1);
103
		
104
		DataPilotFieldSelect.click(1,30);
105
		DataPilotFieldSelect.openContextMenu();
106
		menuItem("Add to Column").select();
107
		assertEquals("Name",CalcUtil.getCellText("B1"));
108
		sleep(1);
109
		
110
		DataPilotFieldSelect.click(1,50);
111
		DataPilotFieldSelect.openContextMenu();
112
		menuItem("Add to Row").select();
113
		assertEquals("Date",CalcUtil.getCellText("A3"));
114
		sleep(1);
115
		
116
		DataPilotFieldSelect.click(1,70);
117
		DataPilotFieldSelect.openContextMenu();
118
		menuItem("Add to Row").select();
119
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
120
		sleep(1);
121
		
122
		DataPilotFieldSelect.click(1,90);
123
		DataPilotFieldSelect.openContextMenu();
124
		menuItem("Add to Data by->Sum").select();
125
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
126
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
127
		sleep(1);
128
		
129
		//Change Locale option settings, and verify it
130
		String target = "New Locale";
131
		DataPilotColumnArea.click(1,1);
132
		DataPilotColumnArea.openContextMenu();
133
		menuItem("Field Option").select();
134
		DataPilotFieldOptionFieldTabPageDialog.select();
135
		DataPilotFieldDisplayNameEditBox.setText(target);
136
		sleep(1);
137
		
138
		DataPilotFieldOptionFiledSubtotalsPage.select();
139
		sleep(1);
140
		DataPilotFieldOptionSubTotalsManuallyRadioButton.check();
141
		sleep(1);
142
		SC_DataPilotOptionSubtotalFunctionList.click(9,24);
143
		sleep(1);
144
		
145
		DataPilotFieldOptionSortTabPageDialog.select();
146
		
147
148
		DataPilotFieldOptionSortDescendingRadioButton.check();
149
		DataPilotFieldOptionFieldTabPageDialog.select();
150
		DataPilotFieldOptionFieldTabPageDialog.ok();
151
		sleep(1);
152
		
153
		assertEquals("New Locale",CalcUtil.getCellText("C1"));
154
		assertEquals("USA",CalcUtil.getCellText("C2"));
155
		assertEquals("USA Count - Amount",CalcUtil.getCellInput("H2"));
156
		assertEquals("17",CalcUtil.getCellInput("H30"));
157
		assertEquals("China Count - Amount",CalcUtil.getCellInput("L2"));
158
		assertEquals("9",CalcUtil.getCellInput("L30"));
159
		assertEquals("32779.17",CalcUtil.getCellInput("M30"));
160
		
161
		DataPilotColumnArea.click(1,30);
162
		DataPilotColumnArea.openContextMenu();
163
		menuItem("Field Option").select();
164
		DataPilotFieldOptionFieldTabPageDialog.select();
165
		DataPilotFieldShowItemWithoutDataCheckBox.check();
166
		DataPilotFieldOptionFieldTabPageDialog.ok();
167
		assertEquals("Emmy Ma",CalcUtil.getCellText("F3"));
168
		assertEquals("32779.17",CalcUtil.getCellInput("U30"));
169
		
170
		CalcUtil.selectRange("C1");
171
		SpreadSheetCells.openContextMenu();
172
		menuItem("Field Option...").select();
173
		DataPilotFieldOptionFieldTabPageDialog.select();
174
		DataPilotFieldDisplayNameEditBox.setText("Locale");
175
		DataPilotFieldOptionFiledSubtotalsPage.select();
176
		DataPilotFieldOptionSubTotalsNeverRadioButton.check();
177
		sleep(1);
178
		DataPilotFieldOptionSortTabPageDialog.select();
179
		DataPilotFieldOptionSortAscendingRadioButton.check();
180
		DataPilotFieldOptionFieldTabPageDialog.select();
181
		DataPilotFieldOptionFieldTabPageDialog.ok();
182
		
183
		assertEquals("Locale",CalcUtil.getCellText("C1"));
184
		assertEquals("China",CalcUtil.getCellText("C2"));
185
		assertEquals("USA",CalcUtil.getCellText("K2"));
186
		assertEquals("32779.17",CalcUtil.getCellInput("S30"));
187
		
188
		
189
		CalcUtil.selectRange("D1");
190
		SpreadSheetCells.openContextMenu();
191
		menuItem("Field Option...").select();
192
		DataPilotFieldOptionFieldTabPageDialog.select();
193
		DataPilotFieldShowItemWithoutDataCheckBox.uncheck();
194
		DataPilotFieldOptionFieldTabPageDialog.ok();
195
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
196
	}
197
198
}
(-)src/testcase/sc/sort/RowsSortWithOptionsCopyResultTo.java (-167 lines)
Lines 1-167 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.sort;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Ignore;
41
import org.junit.Rule;
42
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
/**
50
 *
51
 */
52
public class RowsSortWithOptionsCopyResultTo {
53
	
54
	/**
55
	 * TestCapture helps us to do
56
	 * 1. Take a screenshot when failure occurs.
57
	 * 2. Collect extra data when OpenOffice crashes.
58
	 */	
59
	@Rule
60
	public Log LOG = new Log();
61
	
62
	/**
63
	 * initApp helps us to do 
64
	 * 1. Patch the OpenOffice to enable automation if necessary.
65
	 * 2. Start OpenOffice with automation enabled if necessary.
66
	 * 3. Reset OpenOffice to startcenter.
67
	 * 
68
	 * @throws java.lang.Exception
69
	 */
70
	@Before
71
	public void setUp() throws Exception {
72
		initApp();
73
	}	
74
	
75
	/**
76
	 * Test rows sort with options setting: copy sort result to
77
	 * @throws Exception
78
	 */
79
	@Ignore("Redo is not work when copy sort result to other sheet")
80
	public void testRowsSortWithOptionsCopyResultTo() throws Exception{
81
		
82
		// Create a new spreadsheet document
83
		startcenter.menuItem("File->New->Spreadsheet").select();
84
		sleep(3);
85
		
86
		// Input some data
87
		String[][] data = new String[][] {
88
				{"3", "D"},
89
				{"5", "FLK"},
90
				{"4", "E"},
91
				{"2", "BC"},
92
				{"6", "GE"},
93
				{"1", "AB"},
94
		};
95
		String[][] expectedSortedResult = new String[][] {
96
				{"1", "AB"},
97
				{"2", "BC"},
98
				{"3", "D"},
99
				{"4", "E"},
100
				{"5", "FLK"},
101
				{"6", "GE"},
102
		};
103
		CalcUtil.selectRange("A1");
104
		typeKeys("3<down>5<down>4<down>2<down>6<down>1");
105
		CalcUtil.selectRange("B1");
106
		typeKeys("D<down>FLK<down>E<down>BC<down>GE<down>AB");
107
		
108
		// Data->Sort..., choose "Ascending", check "Copy sort results to:"
109
		calc.menuItem("Data->Sort...").select();
110
		SortOptionsPage.select();
111
		SortOptionsPage_CopyResultTo.check();
112
		SortOptionsPage_CopyResultToEdit.setText("$Sheet3.$A4");
113
		SortOptionsPage.ok();
114
		
115
		// Verify sorted result
116
		assertArrayEquals("Copy sorted result to", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9"));
117
118
		// Uodo/redo
119
		calc.menuItem("Edit->Undo: Sort").select();
120
		sleep(1);
121
		assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet3.$A4"));
122
		calc.menuItem("Edit->Redo: Sort").select();
123
		sleep(1);
124
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9"));
125
		
126
		// Move focus to sheet2 then select a cell range, Insert->Names->Define...
127
		CalcUtil.selectRange("$Sheet2.$A1:$B3");
128
		calc.menuItem("Insert->Names->Define...").select();
129
		sleep(1);
130
		DefineNamesDlg_NameEdit.setText("cellRange");
131
		DefineNamesDlg.ok();
132
		
133
		// Set focus to the original data, Data->Sort...
134
		CalcUtil.selectRange("$Sheet1.$B1");
135
		calc.menuItem("Data->Sort...").select();
136
		SortOptionsPage.select();
137
		SortOptionsPage_CopyResultTo.check();
138
		SortOptionsPage_CopyResultToCellRange.select("cellRange");
139
		SortOptionsPage.ok();		
140
		
141
		// Verify sorted result
142
		assertArrayEquals("Copy sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6"));
143
		
144
		// Uodo/redo
145
		calc.menuItem("Edit->Undo: Sort").select();
146
		sleep(1);
147
		assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet2.$A1"));
148
		calc.menuItem("Edit->Redo: Sort").select();
149
		sleep(1);
150
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6"));
151
		
152
		// Save and close document
153
		String saveTo = fullPath("temp/" + "RowsSortWithOptionsCopyResultTo.ods");
154
		calc.menuItem("File->Save As...").select();
155
		FileUtil.deleteFile(saveTo);
156
		submitSaveDlg(saveTo);	
157
		calc.menuItem("File->Close").select();
158
		openStartcenter();
159
		
160
		// Reopen and verify sorted result
161
		startcenter.menuItem("File->Open...").select();
162
		submitOpenDlg(saveTo);
163
		calc.waitForExistence(10, 2);
164
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9"));
165
		assertArrayEquals("Saved sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6"));
166
	}
167
}
(-)src/testcase/sc/sort/SortCriteriaSortSecondBy.java (-152 lines)
Lines 1-152 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.sort;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.sleep;
34
import static org.openoffice.test.vcl.Tester.typeKeys;
35
36
import org.junit.Before;
37
import org.junit.Ignore;
38
import org.junit.Rule;
39
import org.junit.Test;
40
import org.openoffice.test.common.FileUtil;
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
/**
46
 *
47
 */
48
public class SortCriteriaSortSecondBy {
49
	
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
56
	public Log LOG = new Log();
57
	
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	
71
	/**
72
	 * Test sort criteria: sort second by
73
	 * @throws Exception
74
	 */
75
	@Test
76
	public void testSortCriteriaSortSecondBy() throws Exception{
77
		
78
		// Create a new spreadsheet document
79
		startcenter.menuItem("File->New->Spreadsheet").select();
80
		sleep(3);
81
		
82
		// Input some data
83
		String[][] data = new String[][] {
84
				{"3", "D"},
85
				{"5", "FLK"},
86
				{"4", "E"},
87
				{"1", "AB"},
88
				{"6", "GE"},
89
				{"2", "AB"},
90
		};
91
		String[][] expectedResultSortFirstByB = new String[][] {
92
				{"1", "AB"},
93
				{"2", "AB"},
94
				{"3", "D"},
95
				{"4", "E"},
96
				{"5", "FLK"},
97
				{"6", "GE"},
98
		};
99
		String[][] expectedResultSortSecondByA= new String[][] {
100
				{"2", "AB"},
101
				{"1", "AB"},
102
				{"3", "D"},
103
				{"4", "E"},
104
				{"5", "FLK"},
105
				{"6", "GE"},
106
		};
107
		CalcUtil.selectRange("A1");
108
		typeKeys("3<down>5<down>4<down>1<down>6<down>2");
109
		CalcUtil.selectRange("B1");
110
		typeKeys("D<down>FLK<down>E<down>AB<down>GE<down>AB");
111
		
112
		// "Data->Sort...", choose "Ascending", sort first by Column B
113
		calc.menuItem("Data->Sort...").select();
114
		SortPage_Ascending1.check();
115
		SortPage_By1.select("Column B");
116
		SortPage.ok();
117
		
118
		// Verify sorted result
119
		assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6"));
120
		
121
		// Uodo/redo
122
		calc.menuItem("Edit->Undo: Sort").select();
123
		sleep(1);
124
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:B6"));
125
		calc.menuItem("Edit->Redo: Sort").select();
126
		sleep(1);
127
		assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6"));
128
		calc.menuItem("Edit->Undo: Sort").select();
129
		
130
		// Save and close document
131
		String saveTo = fullPath("temp/" + "SortCriteriaSortSecondBy.ods");
132
		calc.menuItem("File->Save As...").select();
133
		FileUtil.deleteFile(saveTo);
134
		submitSaveDlg(saveTo);	
135
		calc.menuItem("File->Close").select();
136
		openStartcenter();
137
		
138
		// Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column A "Descending"
139
		startcenter.menuItem("File->Open...").select();
140
		submitOpenDlg(saveTo);
141
		calc.waitForExistence(10, 2);
142
		calc.menuItem("Data->Sort...").select();
143
		SortPage_By1.select("Column B");
144
		SortPage_Ascending1.check();
145
		SortPage_By2.select("Column A");
146
		SortPage_Descending2.check();
147
		SortPage.ok();
148
149
		// Verify sorted result
150
		assertArrayEquals("Saved sorted result", expectedResultSortSecondByA, CalcUtil.getCellTexts("A1:B6"));
151
	}	
152
}
(-)src/testcase/sc/validity/AllowDateNotBetween.java (-158 lines)
Lines 1-158 Link Here
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.sc.validity;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.io.File;
30
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
35
import org.junit.Before;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.vcl.IDList;
39
import org.openoffice.test.vcl.widgets.VclMessageBox;
40
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
46
public class AllowDateNotBetween {
47
	private static IDList idList = new IDList(new File("./ids"));
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
49
	
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
56
	public Log LOG = new Log();
57
	
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	
71
	/**
72
	 * test Allow not between Date type in Validity.
73
	 */
74
	@Test
75
	public void testAllowDateNotBetween() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
79
		CalcUtil.selectRange("Sheet1.A1:B5");
80
		calc.menuItem("Data->Validity...").select();
81
		sleep(1);
82
		SC_ValidityCriteriaTabpage.select();
83
		SC_ValidityCriteriaAllowList.select("Date");
84
		SC_ValidityDecimalCompareOperator.select("not between");
85
		SC_ValiditySourceInput.setText("01/01/08");
86
		SC_ValidityMaxValueInput.setText("03/01/08");
87
		SC_ValidityErrorAlertTabPage.select();
88
		SC_ValidityShowErrorMessage.check();
89
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
90
		SC_ValidityErrorMessage.setText("Invalid value");
91
		typeKeys("<tab>");
92
		typeKeys("<enter>");	
93
		sleep(1);
94
				
95
		CalcUtil.selectRange("Sheet1.A1");
96
		SC_CellInput.activate();
97
		typeKeys("12/31/07");
98
		typeKeys("<enter>");
99
		assertEquals("12/31/07",CalcUtil.getCellText("Sheet1.A1"));
100
		
101
		CalcUtil.selectRange("Sheet1.A2");
102
		SC_CellInput.activate();
103
		typeKeys("03/02/08");
104
		typeKeys("<enter>");
105
		assertEquals("03/02/08",CalcUtil.getCellText("Sheet1.A2"));
106
		
107
		CalcUtil.selectRange("Sheet1.A3");
108
		SC_CellInput.activate();
109
		typeKeys("01/01/08");
110
		typeKeys("<enter>");
111
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
112
		ActiveMsgBox.ok();
113
		assertEquals("",CalcUtil.getCellText("Sheet1.A3"));
114
115
		CalcUtil.selectRange("Sheet1.A4");
116
		SC_CellInput.activate();
117
		typeKeys("03/01/08");
118
		typeKeys("<enter>");
119
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
120
		ActiveMsgBox.ok();
121
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
122
123
		CalcUtil.selectRange("Sheet1.A5");
124
		SC_CellInput.activate();
125
		typeKeys("01/02/08");
126
		typeKeys("<enter>");
127
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
128
		ActiveMsgBox.ok();
129
		assertEquals("",CalcUtil.getCellText("Sheet1.A5"));
130
		
131
		CalcUtil.selectRange("Sheet1.B1");
132
		SC_CellInput.activate();
133
		typeKeys("02/29/08");
134
		typeKeys("<enter>");
135
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
136
		ActiveMsgBox.ok();
137
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
138
		
139
		CalcUtil.selectRange("Sheet1.B2");
140
		SC_CellInput.activate();
141
		typeKeys("test");
142
		typeKeys("<enter>");
143
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
144
		ActiveMsgBox.ok();
145
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
146
		
147
		CalcUtil.selectRange("Sheet1.B3");
148
		SC_CellInput.activate();
149
		typeKeys("39448");
150
		typeKeys("<enter>");
151
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
152
		ActiveMsgBox.ok();
153
		assertEquals("",CalcUtil.getCellText("Sheet1.B3"));
154
		
155
		}
156
157
}
158
(-)src/testcase/sc/datapilot/SubtotalsFunctionInGroupedField.java (-214 lines)
Lines 1-214 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 *
50
 *
51
 */
52
public class SubtotalsFunctionInGroupedField {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while add fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();		
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
		}
95
		
96
		DataPilotFieldSelect.click(1, 1);
97
		DataPilotFieldSelect.openContextMenu();
98
		menuItem("Add to Page").select();
99
		assertEquals("Locale",CalcUtil.getCellText("A1"));
100
		sleep(1);
101
		
102
		DataPilotFieldSelect.click(1,30);
103
		DataPilotFieldSelect.openContextMenu();
104
		menuItem("Add to Column").select();
105
		assertEquals("Name",CalcUtil.getCellText("A3"));
106
		sleep(1);
107
		
108
		DataPilotFieldSelect.click(1,50);
109
		DataPilotFieldSelect.openContextMenu();
110
		menuItem("Add to Row").select();
111
		assertEquals("Date",CalcUtil.getCellText("A4"));
112
		sleep(1);
113
		
114
		DataPilotFieldSelect.click(1,70);
115
		DataPilotFieldSelect.openContextMenu();
116
		menuItem("Add to Data by->Sum").select();
117
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
118
		assertEquals("266773",CalcUtil.getCellText("J23"));
119
		sleep(1);
120
		
121
		CalcUtil.selectRange("B4:C4");
122
		SpreadSheetCells.openContextMenu();
123
		menuItem("Group->Group Selected Items").select();
124
		assertEquals("Name2",CalcUtil.getCellText("B3"));
125
		assertEquals("Name",CalcUtil.getCellText("C3"));
126
		assertEquals("Group1",CalcUtil.getCellText("D4"));
127
		assertEquals("266773",CalcUtil.getCellText("J24"));
128
		sleep(1);
129
		
130
		CalcUtil.selectRange("B3");
131
		SpreadSheetCells.openContextMenu();
132
		menuItem("Field Option...").select();
133
		DataPilotFieldOptionFiledSubtotalsPage.select();
134
		sleep(1);
135
		
136
		DataPilotFieldOptionSubTotalsManuallyRadioButton.check();
137
		
138
		SC_DataPilotOptionSubtotalFunctionList.click(9,24);
139
		sleep(1);
140
		DataPilotFieldOptionFieldTabPageDialog.select();
141
		DataPilotFieldOptionFieldTabPageDialog.ok();
142
		
143
		assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4"));
144
		assertEquals("5",CalcUtil.getCellText("C24"));
145
		
146
		assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4"));
147
		assertEquals("2",CalcUtil.getCellText("E24"));
148
		
149
		assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4"));
150
		assertEquals("9",CalcUtil.getCellText("H24"));
151
		
152
		assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4"));
153
		assertEquals("1",CalcUtil.getCellText("J24"));
154
		
155
		assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4"));
156
		assertEquals("2",CalcUtil.getCellText("L24"));
157
		
158
		assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4"));
159
		assertEquals("4",CalcUtil.getCellText("N24"));
160
		
161
		assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4"));
162
		assertEquals("3",CalcUtil.getCellText("P24"));
163
		assertEquals("266773",CalcUtil.getCellText("Q24"));
164
		sleep(1);
165
		
166
		typeKeys("<$undo>");
167
		assertEquals("Emmy Ma",CalcUtil.getCellText("C4"));
168
		assertEquals("20518",CalcUtil.getCellText("C24"));
169
		
170
		assertEquals("",CalcUtil.getCellText("E4"));
171
		assertEquals("20528",CalcUtil.getCellText("E24"));
172
		
173
		assertEquals("Joe Liu",CalcUtil.getCellText("H4"));
174
		assertEquals("41056",CalcUtil.getCellText("H24"));
175
		
176
		assertEquals("Total Result",CalcUtil.getCellText("J4"));
177
		assertEquals("266773",CalcUtil.getCellText("J24"));
178
		
179
		assertEquals("",CalcUtil.getCellText("L4"));
180
		assertEquals("",CalcUtil.getCellText("L24"));
181
		
182
		assertEquals("",CalcUtil.getCellText("N4"));
183
		assertEquals("",CalcUtil.getCellText("N24"));
184
		
185
		assertEquals("",CalcUtil.getCellText("P4"));
186
		assertEquals("",CalcUtil.getCellText("P24"));
187
		assertEquals("",CalcUtil.getCellText("Q24"));
188
		sleep(1);
189
		
190
		typeKeys("<$redo>");
191
		assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4"));
192
		assertEquals("5",CalcUtil.getCellText("C24"));
193
		
194
		assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4"));
195
		assertEquals("2",CalcUtil.getCellText("E24"));
196
		
197
		assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4"));
198
		assertEquals("9",CalcUtil.getCellText("H24"));
199
		
200
		assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4"));
201
		assertEquals("1",CalcUtil.getCellText("J24"));
202
		
203
		assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4"));
204
		assertEquals("2",CalcUtil.getCellText("L24"));
205
		
206
		assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4"));
207
		assertEquals("4",CalcUtil.getCellText("N24"));
208
		
209
		assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4"));
210
		assertEquals("3",CalcUtil.getCellText("P24"));
211
		assertEquals("266773",CalcUtil.getCellText("Q24"));
212
	}
213
214
}
(-)src/testcase/sc/datapilot/OneMRowDataPilotRefresh.java (-132 lines)
Lines 1-132 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
49
/**
50
 * 
51
 *
52
 */
53
public class OneMRowDataPilotRefresh {
54
	/**
55
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
56
	 * Collect extra data when OpenOffice crashes.
57
	 */
58
	@Rule
59
	public Log LOG = new Log();
60
61
	/**
62
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
63
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
64
	 * Reset OpenOffice to startcenter.
65
	 * 
66
	 * @throws java.lang.Exception
67
	 */
68
	@Before
69
	public void setUp() throws Exception {
70
		initApp();
71
	}
72
	/**
73
	 * 
74
	 * Verify the data pilot result table refresh after source data changed
75
	 */
76
	@Test
77
	public void test() {
78
		String file = testFile("source_data01.ods");
79
		startcenter.menuItem("File->Open...").select();
80
		submitOpenDlg(file);
81
		sleep(2);
82
		calc.maximize();
83
		CalcUtil.selectRange("A1:E27");
84
		typeKeys("<$copy>");
85
		CalcUtil.selectRange("A1048540");
86
		typeKeys("<$paste>");
87
		calc.menuItem("Data->DataPilot->Start...").select();
88
		DataPilotTableToExistPlaceRadioButton.check();
89
		assertTrue(DataPilotTableToExistPlaceRadioButton.isChecked());
90
		DataPilotTableToExistPlaceEditBox.setText("$A.$F$1048540");
91
		CreateDataPilotTableDialog.ok();
92
		sleep(1);
93
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
94
			DataPilotAutomaticallyUpdateCheckBox.check();
95
			
96
		}
97
		DataPilotFieldSelect.click(1, 1);
98
		DataPilotFieldSelect.openContextMenu();
99
		menuItem("Add to Page").select();
100
		assertEquals("Locale",CalcUtil.getCellText("F1048540"));
101
		sleep(1);
102
		
103
		DataPilotFieldSelect.click(1,30);
104
		DataPilotFieldSelect.openContextMenu();
105
		menuItem("Add to Column").select();
106
		assertEquals("Name",CalcUtil.getCellText("F1048542"));
107
		sleep(1);
108
		
109
		DataPilotFieldSelect.click(1,50);
110
		DataPilotFieldSelect.openContextMenu();
111
		menuItem("Add to Row").select();
112
		assertEquals("Date",CalcUtil.getCellText("F1048543"));
113
		sleep(1);
114
		
115
		DataPilotFieldSelect.click(1,70);
116
		DataPilotFieldSelect.openContextMenu();
117
		menuItem("Add to Data by->Sum").select();
118
		assertEquals("Sum - Order Number",CalcUtil.getCellText("F1048542"));
119
		assertEquals("266773",CalcUtil.getCellText("O1048562"));
120
		sleep(1);
121
		
122
		CalcUtil.selectRange("D1048541");
123
		typeKeys("10000<enter>");
124
		sleep(1);
125
		
126
		CalcUtil.selectRange("O1048562");
127
		calc.menuItem("Data->DataPilot->Refresh").select();
128
		assertEquals("266525",CalcUtil.getCellText("O1048562"));
129
		
130
	}
131
132
}
(-)src/testcase/sc/validity/FFCIgnoreBlank.java (-97 lines)
Lines 1-97 Link Here
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.sc.validity;
25
26
import static testlib.AppUtil.fullPath;
27
import static testlib.AppUtil.initApp;
28
import static testlib.AppUtil.openStartcenter;
29
import static testlib.AppUtil.submitSaveDlg;
30
import static testlib.AppUtil.submitOpenDlg;
31
import static testlib.AppUtil.testFile;
32
import static testlib.UIMap.startcenter;
33
import static testlib.UIMap.*;
34
35
import java.io.File;
36
37
import static org.junit.Assert.*;
38
import static org.openoffice.test.vcl.Tester.*;
39
import static org.openoffice.test.vcl.Tester.typeKeys;
40
41
import org.junit.Before;
42
import org.junit.Rule;
43
import org.junit.Test;
44
import org.openoffice.test.common.FileUtil;
45
import org.openoffice.test.vcl.IDList;
46
import org.openoffice.test.vcl.widgets.VclMessageBox;
47
48
import testlib.CalcUtil;
49
import testlib.Log;
50
import testlib.UIMap;
51
52
public class FFCIgnoreBlank {
53
		/**
54
	 * TestCapture helps us to doCalcUtil
55
	 * 1. Take a screenshot when failure occurs.
56
	 * 2. Collect extra data when OpenOffice crashes.
57
	 */	
58
	@Rule
59
	public Log LOG = new Log();
60
	
61
	/**
62
	 * initApp helps us to do 
63
	 * 1. Patch the OpenOffice to enable automation if necessary.
64
	 * 2. Start OpenOffice with automation enabled if necessary.
65
	 * 3. Reset OpenOffice to startcenter.
66
	 * 
67
	 * @throws java.lang.Exception
68
	 */
69
	@Before
70
	public void setUp() throws Exception {
71
		initApp();
72
	}
73
	
74
	/**
75
	 * Test open MS 2003 spreadsheet with ignore blank validity.
76
	 * 
77
	 * @throws Exception
78
	 */
79
	@Test
80
	public void testFFCNotIgnoreBlank() throws Exception{
81
		//open sample file
82
		String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls");
83
		startcenter.menuItem("File->Open").select();
84
		submitOpenDlg(file);
85
		
86
		CalcUtil.selectRange("D5");
87
		SC_CellInput.activate();
88
		for(int i=1;i<=10;i++)
89
		typeKeys("<backspace>");
90
		typeKeys("<enter>");
91
	
92
		assertEquals("",CalcUtil.getCellText("D5"));
93
	}
94
	
95
96
	
97
}
(-)src/testcase/sc/sort/SortDialogSetting.java (-35 / +1066 lines)
Lines 28-82 Link Here
28
28
29
import static testlib.AppUtil.*;
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
30
import static testlib.UIMap.*;
31
32
import static org.junit.Assert.*;
31
import static org.junit.Assert.*;
33
32
import static org.openoffice.test.vcl.Tester.*;
33
import org.junit.After;
34
import org.junit.Before;
34
import org.junit.Before;
35
import org.junit.Ignore;
35
import org.junit.Ignore;
36
import org.junit.Rule;
36
import org.junit.Rule;
37
import org.junit.Test;
37
import org.junit.Test;
38
import org.openoffice.test.common.FileUtil;
38
import org.openoffice.test.common.FileUtil;
39
40
import testlib.CalcUtil;
39
import testlib.CalcUtil;
41
import testlib.Log;
40
import testlib.Log;
42
41
43
/**
42
/**
44
 *
43
 * Test Data->Sort dialog setting
45
 */
44
 */
46
public class RowsSortWithOptionsCaseSensitive {
45
public class SortDialogSetting {
47
	
46
48
	/**
49
	 * TestCapture helps us to do
50
	 * 1. Take a screenshot when failure occurs.
51
	 * 2. Collect extra data when OpenOffice crashes.
52
	 */	
53
	@Rule
47
	@Rule
54
	public Log LOG = new Log();
48
	public Log LOG = new Log();
55
	
49
56
	/**
57
	 * initApp helps us to do 
58
	 * 1. Patch the OpenOffice to enable automation if necessary.
59
	 * 2. Start OpenOffice with automation enabled if necessary.
60
	 * 3. Reset OpenOffice to startcenter.
61
	 * 
62
	 * @throws java.lang.Exception
63
	 */
64
	@Before
50
	@Before
65
	public void setUp() throws Exception {
51
	public void setUp() throws Exception {
66
		initApp();
52
		app.start();
53
54
		// Create a new spreadsheet document
55
		startcenter.menuItem("File->New->Spreadsheet").select();
67
	}
56
	}
68
	
57
58
	@After
59
	public void tearDown() throws Exception {
60
		app.close();
61
	}
62
69
	/**
63
	/**
70
	 * Test rows sort with options setting: case sensitive 
64
	 * Test sort with options setting: case sensitive 
71
	 * @throws Exception
65
	 * @throws Exception
72
	 */
66
	 */
73
	@Test
67
	@Test
74
	public void testRowsSortWithOptionsCaseSensitive() throws Exception{
68
	public void testSortOptionsCaseSensitive() throws Exception{
75
		
69
76
		// Create a new spreadsheet document
77
		startcenter.menuItem("File->New->Spreadsheet").select();
78
		sleep(3);
79
		
80
		// Input some data: A1~A6: 1ColumnName,D,C,B,A,a
70
		// Input some data: A1~A6: 1ColumnName,D,C,B,A,a
81
		String[][] data = new String[][] {
71
		String[][] data = new String[][] {
82
				{"D"},
72
				{"D"},
Lines 95-117 Link Here
95
		CalcUtil.selectRange("A1");
85
		CalcUtil.selectRange("A1");
96
		typeKeys("1ColumnName<down>D<down>C<down>B<down>A<down>a<down>");
86
		typeKeys("1ColumnName<down>D<down>C<down>B<down>A<down>a<down>");
97
		CalcUtil.selectRange("A6");
87
		CalcUtil.selectRange("A6");
98
		calc.menuItem("Format->Change Case->Lowercase").select();	// In case SC capitalize first letter automatically
88
		app.dispatch(".uno:ChangeCaseToLower");	// In case SC capitalize first letter automatically
99
		
89
100
		// "Data->Sort...", choose "Ascending", check "Case sensitive"
90
		// "Data->Sort...", choose "Ascending", check "Case sensitive"
101
		calc.menuItem("Data->Sort...").select();
91
		calc.menuItem("Data->Sort...").select();
102
		SortOptionsPage.select();
92
		SortOptionsPage.select();
103
		SortOptionsPage_CaseSensitive.check();
93
		SortOptionsPage_CaseSensitive.check();
104
		SortOptionsPage.ok();		
94
		SortOptionsPage.ok();		
105
		
95
106
		// Verify sorted result
96
		// Verify sorted result
107
		assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
97
		assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
108
		
98
109
		// Uodo/redo
99
		// Uodo/redo
110
		calc.menuItem("Edit->Undo: Sort").select();
100
		calc.menuItem("Edit->Undo: Sort").select();
111
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A2:A6"));
101
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A2:A6"));
112
		calc.menuItem("Edit->Redo: Sort").select();
102
		calc.menuItem("Edit->Redo: Sort").select();
113
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
103
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
114
		
104
115
		// Save and close document
105
		// Save and close document
116
		String saveTo = fullPath("temp/" + "RowsSortWithOptionsCaseSensitive.ods");
106
		String saveTo = fullPath("temp/" + "RowsSortWithOptionsCaseSensitive.ods");
117
		calc.menuItem("File->Save As...").select();
107
		calc.menuItem("File->Save As...").select();
Lines 119-129 Link Here
119
		submitSaveDlg(saveTo);	
109
		submitSaveDlg(saveTo);	
120
		calc.menuItem("File->Close").select();
110
		calc.menuItem("File->Close").select();
121
		openStartcenter();
111
		openStartcenter();
122
		
112
123
		// Reopen and verify sorted result
113
		// Reopen and verify sorted result
124
		startcenter.menuItem("File->Open...").select();
114
		startcenter.menuItem("File->Open...").select();
125
		submitOpenDlg(saveTo);
115
		submitOpenDlg(saveTo);
126
		calc.waitForExistence(10, 2);
116
		calc.waitForExistence(10, 2);
127
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
117
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
128
	}
118
	}
119
120
	/**
121
	 * Test sort with options setting: copy sort result to
122
	 * @throws Exception
123
	 */
124
	@Ignore("Bug 119035")
125
	public void testSortOptionsCopyResultTo() throws Exception{
126
127
		// Input some data
128
		//		String[][] data = new String[][] {
129
		//				{"3", "D"},
130
		//				{"5", "FLK"},
131
		//				{"4", "E"},
132
		//				{"2", "BC"},
133
		//				{"6", "GE"},
134
		//				{"1", "AB"},
135
		//		};
136
		String[][] expectedSortedResult = new String[][] {
137
				{"1", "AB"},
138
				{"2", "BC"},
139
				{"3", "D"},
140
				{"4", "E"},
141
				{"5", "FLK"},
142
				{"6", "GE"},
143
		};
144
		CalcUtil.selectRange("A1");
145
		typeKeys("3<down>5<down>4<down>2<down>6<down>1");
146
		CalcUtil.selectRange("B1");
147
		typeKeys("D<down>FLK<down>E<down>BC<down>GE<down>AB");
148
149
		// Data->Sort..., choose "Ascending", check "Copy sort results to:"
150
		calc.menuItem("Data->Sort...").select();
151
		SortOptionsPage.select();
152
		SortOptionsPage_CopyResultTo.check();
153
		SortOptionsPage_CopyResultToEdit.setText("$Sheet3.$A4");
154
		SortOptionsPage.ok();
155
156
		// Verify sorted result
157
		assertArrayEquals("Copy sorted result to", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9"));
158
159
		// Uodo/redo
160
		calc.menuItem("Edit->Undo: Sort").select();
161
		assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet3.$A4"));
162
		calc.menuItem("Edit->Redo: Sort").select();
163
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9"));
164
165
		// Move focus to sheet2 then select a cell range, Insert->Names->Define...
166
		CalcUtil.selectRange("$Sheet2.$A1:$B3");
167
		calc.menuItem("Insert->Names->Define...").select();
168
		DefineNamesDlg_NameEdit.setText("cellRange");
169
		DefineNamesDlg.ok();
170
171
		// Set focus to the original data, Data->Sort...
172
		CalcUtil.selectRange("$Sheet1.$B1");
173
		calc.menuItem("Data->Sort...").select();
174
		SortOptionsPage.select();
175
		SortOptionsPage_CopyResultTo.check();
176
		SortOptionsPage_CopyResultToCellRange.select("cellRange");
177
		SortOptionsPage.ok();		
178
179
		// Verify sorted result
180
		assertArrayEquals("Copy sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6"));
181
182
		// Uodo/redo
183
		calc.menuItem("Edit->Undo: Sort").select();
184
		assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet2.$A1"));
185
		calc.menuItem("Edit->Redo: Sort").select();
186
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6"));
187
188
		// Save and close document
189
		String saveTo = fullPath("temp/" + "RowsSortWithOptionsCopyResultTo.ods");
190
		calc.menuItem("File->Save As...").select();
191
		FileUtil.deleteFile(saveTo);
192
		submitSaveDlg(saveTo);	
193
		calc.menuItem("File->Close").select();
194
		openStartcenter();
195
196
		// Reopen and verify sorted result
197
		startcenter.menuItem("File->Open...").select();
198
		submitOpenDlg(saveTo);
199
		calc.waitForExistence(10, 2);
200
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9"));
201
		assertArrayEquals("Saved sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6"));
202
	}
203
204
	/**
205
	 * Test sort criteria: sort first by
206
	 * @throws Exception
207
	 */
208
	@Test
209
	public void testSortCriteriaSortFirstBy() throws Exception{
210
211
		// Input some data
212
		String[][] data = new String[][] {
213
				{"3", "D"},
214
				{"5", "FLK"},
215
				{"4", "E"},
216
				{"2", "BC"},
217
				{"6", "GE"},
218
				{"1", "AB"},
219
		};
220
		String[][] expectedResultSortByColumnBAscending = new String[][] {
221
				{"1", "AB"},
222
				{"2", "BC"},
223
				{"3", "D"},
224
				{"4", "E"},
225
				{"5", "FLK"},
226
				{"6", "GE"},
227
		};
228
		String[][] expectedResultSortByColumnADescending = new String[][] {
229
				{"6", "GE"},
230
				{"5", "FLK"},
231
				{"4", "E"},
232
				{"3", "D"},
233
				{"2", "BC"},
234
				{"1", "AB"},
235
		};
236
		CalcUtil.selectRange("A1");
237
		typeKeys("3<down>5<down>4<down>2<down>6<down>1");
238
		CalcUtil.selectRange("B1");
239
		typeKeys("D<down>FLK<down>E<down>BC<down>GE<down>AB");
240
241
		// "Data->Sort...", choose "Ascending", sort first by Column B
242
		calc.menuItem("Data->Sort...").select();
243
		SortPage_Ascending1.check();
244
		SortPage_By1.select("Column B");
245
		SortPage.ok();
246
247
		// Verify sorted result
248
		assertArrayEquals("Sorted result", expectedResultSortByColumnBAscending, CalcUtil.getCellTexts("A1:B6"));
249
250
		// Uodo/redo
251
		calc.menuItem("Edit->Undo: Sort").select();
252
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:B6"));
253
		calc.menuItem("Edit->Redo: Sort").select();
254
		assertArrayEquals("Redo sorted result", expectedResultSortByColumnBAscending, CalcUtil.getCellTexts("A1:B6"));
255
		calc.menuItem("Edit->Undo: Sort").select();
256
257
		// Save and close document
258
		String saveTo = fullPath("temp/" + "SortCriteriaSortFirstBy.ods");
259
		calc.menuItem("File->Save As...").select();
260
		FileUtil.deleteFile(saveTo);
261
		submitSaveDlg(saveTo);	
262
		calc.menuItem("File->Close").select();
263
		openStartcenter();
264
265
		// Reopen, "Data->Sort...", choose "Descending", sort first by Column A
266
		startcenter.menuItem("File->Open...").select();
267
		submitOpenDlg(saveTo);
268
		calc.waitForExistence(10, 2);
269
		calc.menuItem("Data->Sort...").select();
270
		SortPage_Descending1.check();
271
		SortPage_By1.select("Column A");
272
		SortPage.ok();		
273
274
		// Verify sorted result
275
		assertArrayEquals("Saved sorted result", expectedResultSortByColumnADescending, CalcUtil.getCellTexts("A1:B6"));
276
	}	
277
278
	/**
279
	 * Test sort criteria: sort second by
280
	 * @throws Exception
281
	 */
282
	@Test
283
	public void testSortCriteriaSortSecondBy() throws Exception{
284
285
		// Input some data
286
		String[][] data = new String[][] {
287
				{"3", "D"},
288
				{"5", "FLK"},
289
				{"4", "E"},
290
				{"1", "AB"},
291
				{"6", "GE"},
292
				{"2", "AB"},
293
		};
294
		String[][] expectedResultSortFirstByB = new String[][] {
295
				{"1", "AB"},
296
				{"2", "AB"},
297
				{"3", "D"},
298
				{"4", "E"},
299
				{"5", "FLK"},
300
				{"6", "GE"},
301
		};
302
		String[][] expectedResultSortSecondByA= new String[][] {
303
				{"2", "AB"},
304
				{"1", "AB"},
305
				{"3", "D"},
306
				{"4", "E"},
307
				{"5", "FLK"},
308
				{"6", "GE"},
309
		};
310
		CalcUtil.selectRange("A1");
311
		typeKeys("3<down>5<down>4<down>1<down>6<down>2");
312
		CalcUtil.selectRange("B1");
313
		typeKeys("D<down>FLK<down>E<down>AB<down>GE<down>AB");
314
315
		// "Data->Sort...", choose "Ascending", sort first by Column B
316
		calc.menuItem("Data->Sort...").select();
317
		SortPage_Ascending1.check();
318
		SortPage_By1.select("Column B");
319
		SortPage.ok();
320
321
		// Verify sorted result
322
		assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6"));
323
324
		// Uodo/redo
325
		calc.menuItem("Edit->Undo: Sort").select();
326
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:B6"));
327
		calc.menuItem("Edit->Redo: Sort").select();
328
		assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6"));
329
		calc.menuItem("Edit->Undo: Sort").select();
330
331
		// Save and close document
332
		String saveTo = fullPath("temp/" + "SortCriteriaSortSecondBy.ods");
333
		calc.menuItem("File->Save As...").select();
334
		FileUtil.deleteFile(saveTo);
335
		submitSaveDlg(saveTo);	
336
		calc.menuItem("File->Close").select();
337
		openStartcenter();
338
339
		// Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column A "Descending"
340
		startcenter.menuItem("File->Open...").select();
341
		submitOpenDlg(saveTo);
342
		calc.waitForExistence(10, 2);
343
		calc.menuItem("Data->Sort...").select();
344
		SortPage_By1.select("Column B");
345
		SortPage_Ascending1.check();
346
		SortPage_By2.select("Column A");
347
		SortPage_Descending2.check();
348
		SortPage.ok();
349
350
		// Verify sorted result
351
		assertArrayEquals("Saved sorted result", expectedResultSortSecondByA, CalcUtil.getCellTexts("A1:B6"));
352
	}	
353
354
	/**
355
	 * Test sort criteria: sort third by
356
	 * @throws Exception
357
	 */
358
	@Test
359
	public void testSortCriteriaSortThirdBy() throws Exception{
360
361
		// Input some data
362
		String[][] data = new String[][] {
363
				{"3", "AB", "2"},
364
				{"8", "FLK", "5"},
365
				{"6", "E", "4"},
366
				{"1", "AB", "1"},
367
				{"9", "GE", "6"},
368
				{"2", "AB", "2"},
369
				{"7", "EFYU", "7"},
370
				{"5", "DS", "8"},
371
				{"4", "AB", "1"},
372
		};
373
		String[][] expectedResultSortFirstByB = new String[][] {
374
				{"3", "AB", "2"},
375
				{"1", "AB", "1"},
376
				{"2", "AB", "2"},
377
				{"4", "AB", "1"},
378
				{"5", "DS", "8"},
379
				{"6", "E", "4"},
380
				{"7", "EFYU", "7"},
381
				{"8", "FLK", "5"},
382
				{"9", "GE", "6"},
383
		};
384
		String[][] expectedResultSortSecondByC= new String[][] {
385
				{"3", "AB", "2"},
386
				{"2", "AB", "2"},
387
				{"1", "AB", "1"},
388
				{"4", "AB", "1"},
389
				{"5", "DS", "8"},
390
				{"6", "E", "4"},
391
				{"7", "EFYU", "7"},
392
				{"8", "FLK", "5"},
393
				{"9", "GE", "6"},
394
		};
395
		String[][] expectedResultSortThirdByA= new String[][] {
396
				{"3", "AB", "2"},
397
				{"2", "AB", "2"},
398
				{"4", "AB", "1"},
399
				{"1", "AB", "1"},
400
				{"5", "DS", "8"},
401
				{"6", "E", "4"},
402
				{"7", "EFYU", "7"},
403
				{"8", "FLK", "5"},
404
				{"9", "GE", "6"},
405
		};
406
		CalcUtil.selectRange("A1");
407
		typeKeys("3<down>8<down>6<down>1<down>9<down>2<down>7<down>5<down>4");
408
		CalcUtil.selectRange("B1");
409
		typeKeys("AB<down>FLK<down>E<down>AB<down>GE<down>AB<down>EFYU<down>DS<down>AB");
410
		CalcUtil.selectRange("C1");
411
		typeKeys("2<down>5<down>4<down>1<down>6<down>2<down>7<down>8<down>1");
412
		sleep(0.5);
413
414
		// "Data->Sort...", choose "Ascending", sort first by Column B
415
		calc.menuItem("Data->Sort...").select();
416
		SortPage_By1.select("Column B");
417
		SortPage_Ascending1.check();
418
		SortPage.ok();
419
420
		// Verify sorted result
421
		assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9"));
422
423
		// Uodo/redo
424
		calc.menuItem("Edit->Undo: Sort").select();
425
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:C9"));
426
		calc.menuItem("Edit->Redo: Sort").select();
427
		assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9"));
428
		calc.menuItem("Edit->Undo: Sort").select();
429
430
		// Save and close document
431
		String saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy.ods");
432
		calc.menuItem("File->Save As...").select();
433
		FileUtil.deleteFile(saveTo);
434
		submitSaveDlg(saveTo);	
435
		calc.menuItem("File->Close").select();
436
		openStartcenter();
437
438
		// Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending"
439
		startcenter.menuItem("File->Open...").select();
440
		submitOpenDlg(saveTo);
441
		calc.waitForExistence(10, 2);
442
		calc.menuItem("Data->Sort...").select();
443
		SortPage_By1.select("Column B");
444
		SortPage_Ascending1.check();
445
		SortPage_By2.select("Column C");
446
		SortPage_Descending2.check();
447
		SortPage.ok();
448
449
		// Verify sorted result
450
		assertArrayEquals("Sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9"));
451
452
		// "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending", sort third by Column A "Descending"
453
		calc.menuItem("Data->Sort...").select();
454
		SortPage_By1.select("Column B");
455
		SortPage_Ascending1.check();
456
		SortPage_By2.select("Column C");
457
		SortPage_Descending2.check();
458
		SortPage_By3.select("Column A");
459
		SortPage_Descending3.check();
460
		SortPage.ok();
461
462
		// Verify sorted result
463
		assertArrayEquals("Sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9"));	
464
465
		// Uodo/redo
466
		calc.menuItem("Edit->Undo: Sort").select();
467
		assertArrayEquals("Undo sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9"));
468
		calc.menuItem("Edit->Redo: Sort").select();
469
		assertArrayEquals("Redo sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9"));
470
471
		// Save and close document
472
		saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy1.ods");
473
		calc.menuItem("File->Save As...").select();
474
		FileUtil.deleteFile(saveTo);
475
		submitSaveDlg(saveTo);	
476
		calc.menuItem("File->Close").select();
477
		openStartcenter();
478
479
		// Reopen and verify data sort is not lost
480
		startcenter.menuItem("File->Open...").select();
481
		submitOpenDlg(saveTo);
482
		calc.waitForExistence(10, 2);
483
		assertArrayEquals("Saved sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9"));	
484
	}	
485
486
	/**
487
	 * Test sort options: custom sort order, predefined in preferences from copy list
488
	 * @throws Exception
489
	 */
490
	@Test
491
	public void testSortOptionsCustomSortOrderPredefineFromCopyList() throws Exception{
492
493
		// Dependencies start
494
		CalcUtil.selectRange("A1");
495
		typeKeys("red<down>yellow<down>blue<down>green<down>white<down>black");
496
		CalcUtil.selectRange("A1:A6");
497
		app.dispatch(".uno:ChangeCaseToLower");	// In case SC capitalize first letter automatically
498
499
		// Select the cell range, "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists"
500
		CalcUtil.selectRange("A1:A6");
501
		app.dispatch(".uno:OptionsTreeDialog");
502
		// Select "Sort Lists": start. Shrink the tree list and select
503
		OptionsDlgList.select(0);
504
		typeKeys("<left>");
505
		for (int i=0; i<6; i++) {
506
			typeKeys("<down><left>");	
507
		}
508
		OptionsDlgList.select(3);
509
		typeKeys("<right>");
510
		OptionsDlgList.select(7);
511
		// Select "Sort Lists": end
512
513
		// Click "Copy" button, "OK", close the document		
514
		OptionsDlg_SortListsTabCopy.click();
515
		OptionsDlg.ok();
516
		calc.menuItem("File->Close").select();
517
		MsgBox_AdditionalRowsNotSaved.no();
518
		// Dependencies end
519
520
		// Create a new spreadsheet document
521
		startcenter.menuItem("File->New->Spreadsheet").select();
522
523
		// Input some data
524
		String[][] data = new String[][] {
525
				{"Color"},
526
				{"black"},
527
				{"yellow"},
528
				{"blue"},
529
				{"black"},
530
				{"white"},
531
				{"red"},
532
		};
533
		String[][] expectedResultNoCustomSortOrder = new String[][] {
534
				{"Color"},
535
				{"black"},
536
				{"black"},
537
				{"blue"},
538
				{"red"},
539
				{"white"},
540
				{"yellow"},
541
		};
542
		String[][] expectedResultCustomSortOrder = new String[][] {
543
				{"Color"},
544
				{"red"},
545
				{"yellow"},
546
				{"blue"},
547
				{"white"},
548
				{"black"},
549
				{"black"},
550
		};
551
		CalcUtil.selectRange("A1");
552
		typeKeys("Color<down>black<down>yellow<down>blue<down>black<down>white<down>red");
553
		CalcUtil.selectRange("A2:A7");
554
		app.dispatch(".uno:ChangeCaseToLower");	// In case SC capitalize first letter automatically
555
556
		// "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color
557
		CalcUtil.selectRange("A1:A7");
558
		calc.menuItem("Data->Sort...").select();
559
		SortOptionsPage.select();
560
		SortOptionsPage_RangeContainsColumnLabels.check();
561
		SortOptionsPage_CustomSortOrder.uncheck();
562
		SortPage.select();
563
		SortPage_By1.select("Color");
564
		SortPage_Ascending1.check();
565
		SortPage.ok();	
566
567
		// Verify sorted result
568
		assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
569
570
		// Uodo/redo
571
		calc.menuItem("Edit->Undo: Sort").select();
572
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
573
		calc.menuItem("Edit->Redo: Sort").select();
574
		assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
575
		calc.menuItem("Edit->Undo: Sort").select();
576
577
		// Copy original data to sheet2
578
		CalcUtil.selectRange("A1:A7");
579
		calc.menuItem("Edit->Copy").select();
580
		CalcUtil.selectRange("Sheet2.A1");
581
		calc.menuItem("Edit->Paste").select();		
582
583
		// "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color
584
		calc.menuItem("Data->Sort...").select();
585
		SortOptionsPage.select();
586
		SortOptionsPage_RangeContainsColumnLabels.check();
587
		SortOptionsPage_CustomSortOrder.check();
588
		SortOptionsPage_CustomSortOrderList.select("red,yellow,blue,green,white,black");
589
		SortPage.select();
590
		SortPage_By1.select("Color");
591
		SortPage_Ascending1.check();
592
		SortPage.ok();	
593
594
		// Verify sorted result
595
		assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
596
597
		// Uodo/redo
598
		calc.menuItem("Edit->Undo: Sort").select();
599
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
600
		calc.menuItem("Edit->Redo: Sort").select();
601
		assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
602
603
		// Save and close document
604
		String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromCopyList.ods");
605
		calc.menuItem("File->Save As...").select();
606
		FileUtil.deleteFile(saveTo);
607
		submitSaveDlg(saveTo);	
608
		calc.menuItem("File->Close").select();
609
		openStartcenter();
610
611
		// Reopen and verify sorted result
612
		startcenter.menuItem("File->Open...").select();
613
		submitOpenDlg(saveTo);
614
		calc.waitForExistence(10, 2);
615
		assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7"));
616
		assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7"));
617
	}	
618
619
	/**
620
	 * Test sort options: custom sort order, predefined in preferences from new list
621
	 * @throws Exception
622
	 */
623
	@Test
624
	public void testSortOptionsCustomSortOrderPredefineFromNewList() throws Exception{
625
626
		// Dependencies start
627
		// "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists"
628
		app.dispatch(".uno:OptionsTreeDialog");
629
		// Select "Sort Lists": start. Shrink the tree list and select
630
		OptionsDlgList.select(0);
631
		typeKeys("<left>");
632
		for (int i=0; i<6; i++) {
633
			typeKeys("<down><left>");	
634
		}
635
		OptionsDlgList.select(3);
636
		typeKeys("<right>");
637
		OptionsDlgList.select(7);
638
		// Select "Sort Lists": end
639
640
		// Click "New" button, input "white,red,yellow,blue,green,black", press "Add" and "OK", close the document		
641
		OptionsDlg_SortListsTabNew.click();
642
		typeKeys("white,red,yellow,blue,green,black");
643
		OptionsDlg_SortListsTabAdd.click();
644
		sleep(0.5);
645
		OptionsDlg.ok();
646
		calc.menuItem("File->Close").select();
647
		// Dependencies end
648
649
		// Create a new spreadsheet document
650
		startcenter.menuItem("File->New->Spreadsheet").select();
651
		sleep(3);
652
653
		// Input some data
654
		String[][] data = new String[][] {
655
				{"Color"},
656
				{"black"},
657
				{"yellow"},
658
				{"blue"},
659
				{"black"},
660
				{"white"},
661
				{"red"},
662
		};
663
		String[][] expectedResultNoCustomSortOrder = new String[][] {
664
				{"Color"},
665
				{"black"},
666
				{"black"},
667
				{"blue"},
668
				{"red"},
669
				{"white"},
670
				{"yellow"},
671
		};
672
		String[][] expectedResultCustomSortOrder = new String[][] {
673
				{"Color"},
674
				{"white"},
675
				{"red"},
676
				{"yellow"},
677
				{"blue"},
678
				{"black"},
679
				{"black"},
680
		};
681
		CalcUtil.selectRange("A1");
682
		typeKeys("Color<down>black<down>yellow<down>blue<down>black<down>white<down>red");
683
		CalcUtil.selectRange("A2:A7");
684
		app.dispatch(".uno:ChangeCaseToLower");	// In case SC capitalize first letter automatically
685
686
		// "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color
687
		CalcUtil.selectRange("A1:A7");
688
		calc.menuItem("Data->Sort...").select();
689
		SortOptionsPage.select();
690
		SortOptionsPage_RangeContainsColumnLabels.check();
691
		SortOptionsPage_CustomSortOrder.uncheck();
692
		SortPage.select();
693
		SortPage_By1.select("Color");
694
		SortPage_Ascending1.check();
695
		SortPage.ok();	
696
697
		// Verify sorted result
698
		assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
699
700
		// Uodo/redo
701
		calc.menuItem("Edit->Undo: Sort").select();
702
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
703
		calc.menuItem("Edit->Redo: Sort").select();
704
		assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
705
		calc.menuItem("Edit->Undo: Sort").select();
706
707
		// Copy original data to sheet2
708
		CalcUtil.selectRange("A1:A7");
709
		calc.menuItem("Edit->Copy").select();
710
		CalcUtil.selectRange("Sheet2.A1");
711
		calc.menuItem("Edit->Paste").select();		
712
713
		// "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color
714
		calc.menuItem("Data->Sort...").select();
715
		SortOptionsPage.select();
716
		SortOptionsPage_RangeContainsColumnLabels.check();
717
		SortOptionsPage_CustomSortOrder.check();
718
		SortOptionsPage_CustomSortOrderList.select("white,red,yellow,blue,green,black");
719
		SortPage.select();
720
		SortPage_By1.select("Color");
721
		SortPage_Ascending1.check();
722
		SortPage.ok();	
723
724
		// Verify sorted result
725
		assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
726
727
		// Uodo/redo
728
		calc.menuItem("Edit->Undo: Sort").select();
729
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
730
		calc.menuItem("Edit->Redo: Sort").select();
731
		assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
732
733
		// Save and close document
734
		String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromNewList.ods");
735
		calc.menuItem("File->Save As...").select();
736
		FileUtil.deleteFile(saveTo);
737
		submitSaveDlg(saveTo);	
738
		calc.menuItem("File->Close").select();
739
		openStartcenter();
740
741
		// Reopen and verify sorted result
742
		startcenter.menuItem("File->Open...").select();
743
		submitOpenDlg(saveTo);
744
		calc.waitForExistence(10, 2);
745
		assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7"));
746
		assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7"));
747
	}	
748
749
	/**
750
	 * Test sort options: sort columns, direction "Left to right"
751
	 * @throws Exception
752
	 */
753
	@Test
754
	public void testSortOptionsDirectionSortColumns() throws Exception{
755
756
		// Input some data
757
		String[][] data = new String[][] {
758
				{"Units", "7", "27", "4", "12", "3", "6"},
759
		};
760
		String[][] expectedSortedResult = new String[][] {
761
				{"Units", "3", "4", "6", "7", "12", "27"},
762
		};
763
		CalcUtil.selectRange("A1");
764
		typeKeys("Units<right>7<right>27<right>4<right>12<right>3<right>6");
765
766
		// "Data->Sort...", check "Range contains column labels", "Left to right", sort first by"Units", "Ascending"
767
		calc.menuItem("Data->Sort...").select();
768
		SortOptionsPage.select();
769
		SortOptionsPage_RangeContainsColumnLabels.check();
770
		SortOptionsPage_LeftToRight.check();
771
		SortPage.select();
772
		SortPage_By1.select("Units");
773
		SortPage_Ascending1.check();
774
		SortPage.ok();		
775
776
		// Verify sorted result
777
		assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1"));
778
779
		// Uodo/redo
780
		calc.menuItem("Edit->Undo: Sort").select();
781
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:G1"));
782
		calc.menuItem("Edit->Redo: Sort").select();
783
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1"));
784
785
		// Save and close document
786
		String saveTo = fullPath("temp/" + "SortOptionsDirectionSortColumns.ods");
787
		calc.menuItem("File->Save As...").select();
788
		FileUtil.deleteFile(saveTo);
789
		submitSaveDlg(saveTo);	
790
		calc.menuItem("File->Close").select();
791
		openStartcenter();
792
793
		// Reopen and verify sorted result
794
		startcenter.menuItem("File->Open...").select();
795
		submitOpenDlg(saveTo);
796
		calc.waitForExistence(10, 2);
797
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1"));
798
	}
799
800
	/**
801
	 * Test sort options: "Include formats"
802
	 * @throws Exception
803
	 */
804
	@Test
805
	public void testSortOptionsIncludeFormats() throws Exception{
806
807
		// Create a new spreadsheet document
808
809
		String[][] dataWithCurrencyFormats = new String[][] {
810
				{"Units"},
811
				{"$32.00"},
812
				{"57.00 \u20ac"},
813
				{"\u20a4 74"},
814
				{"R$ 50.00"},
815
				{"\u062c.\u0645. 27"},
816
				{"7.00 \u0440\u0443\u0431"},
817
		};
818
		String[][] expectedSortedResultIncludeFormat = new String[][] {
819
				{"Units"},
820
				{"7.00 \u0440\u0443\u0431"},
821
				{"\u062c.\u0645. 27"},
822
				{"$32.00"},
823
				{"R$ 50.00"},
824
				{"57.00 \u20ac"},
825
				{"\u20a4 74"},
826
		};
827
		String[][] expectedSortedResultExcludeFormat = new String[][] {
828
				{"Units"},
829
				{"$7.00"},
830
				{"27.00 \u20ac"},
831
				{"\u20a4 32"},
832
				{"R$ 50.00"},
833
				{"\u062c.\u0645. 57"},
834
				{"74.00 \u0440\u0443\u0431"},
835
		};
836
837
		// Input source data
838
		String file = testFile("sc/SortOptionsIncludeFormats.ods");
839
		//		String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls");
840
		app.dispatch(".uno:Open", 3);
841
		submitOpenDlg(file);
842
		calc.waitForExistence(10, 2);
843
844
		assertArrayEquals("source", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7"));
845
846
		//		CalcUtil.selectRange("A1");
847
		//		typeKeys("Units<down>$32.00<down>57.00 \u20ac<down>\u20a4 74<down>R$ 50.00<down>\u062c.\u0645. 27.00<down>7.00 \u0440\u0443\u0431.");
848
849
		//		// Set Currency formats
850
		//		CalcUtil.selectRange("A2");
851
		//		typeKeys("<ctrl 1>");
852
		////		calc.menuItem("Fortmat->Cells...").select(); error: can not find item "Format"
853
		//		FormatCellsDlg_NumbersPage.select();
854
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
855
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("$ English (USA)");
856
		//		FormatCellsDlg_NumbersPage.ok();
857
		//		CalcUtil.selectRange("A3");
858
		//		typeKeys("<ctrl 1>");
859
		//		FormatCellsDlg_NumbersPage.select();
860
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
861
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20ac Spanish (Spain)");
862
		//		FormatCellsDlg_NumbersPage.ok();
863
		//		CalcUtil.selectRange("A4");
864
		//		typeKeys("<ctrl 1>");
865
		//		FormatCellsDlg_NumbersPage.select();
866
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
867
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20a4 Latin");
868
		//		FormatCellsDlg_NumbersPage.ok();		
869
		//		CalcUtil.selectRange("A5");
870
		//		typeKeys("<ctrl 1>");
871
		//		FormatCellsDlg_NumbersPage.select();
872
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
873
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("R$ Portuguese (Brazil)");
874
		//		FormatCellsDlg_NumbersPage.ok();	
875
		//		CalcUtil.selectRange("A6");
876
		//		typeKeys("<ctrl 1>");
877
		//		FormatCellsDlg_NumbersPage.select();
878
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
879
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u062c.\u0645. Arabic (Egypt)");
880
		//		FormatCellsDlg_NumbersPage.ok();	
881
		//		CalcUtil.selectRange("A7");
882
		//		typeKeys("<ctrl 1>");
883
		//		FormatCellsDlg_NumbersPage.select();
884
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
885
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u0440\u0443\u0431. Russian");
886
		//		FormatCellsDlg_NumbersPage.ok();	
887
888
		// "Data->Sort...", check "Range contains column labels", check "Include formats", sort first by "Units", "Ascending"
889
		calc.menuItem("Data->Sort...").select();
890
		SortOptionsPage.select();
891
		SortOptionsPage_RangeContainsColumnLabels.check();
892
		SortOptionsPage_IncludeFormats.check();
893
		SortPage.select();
894
		SortPage_By1.select("Units");
895
		SortPage_Ascending1.check();
896
		SortPage.ok();		
897
898
		// Verify sorted result
899
		assertArrayEquals("Sorted result include formats", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7"));
900
901
		// Uodo/redo
902
		calc.menuItem("Edit->Undo: Sort").select();
903
		assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7"));
904
		calc.menuItem("Edit->Redo: Sort").select();
905
		assertArrayEquals("Redo sorted result", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7"));
906
		calc.menuItem("Edit->Undo: Sort").select();
907
908
		// Copy the original data to sheet2
909
		CalcUtil.selectRange("A1:A7");
910
		calc.menuItem("Edit->Copy").select();
911
		CalcUtil.selectRange("Sheet2.A1");
912
		calc.menuItem("Edit->Paste").select();		
913
914
		// "Data->Sort...", check "Range contains column labels", uncheck "Include formats", sort first by "Units", "Ascending"
915
		calc.menuItem("Data->Sort...").select();
916
		SortOptionsPage.select();
917
		SortOptionsPage_RangeContainsColumnLabels.check();
918
		SortOptionsPage_IncludeFormats.uncheck();
919
		SortPage.select();
920
		SortPage_By1.select("Units");
921
		SortPage_Ascending1.check();
922
		SortPage.ok();		
923
924
		// Verify sorted result
925
		assertArrayEquals("Sorted result exclude formats", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7"));	
926
927
		// Uodo/redo
928
		calc.menuItem("Edit->Undo: Sort").select();
929
		assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7"));
930
		calc.menuItem("Edit->Redo: Sort").select();
931
		assertArrayEquals("Redo sorted result", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7"));
932
933
		// Save and close document
934
		String saveTo = fullPath("temp/" + "SortOptionsIncludeFormats.ods");
935
		calc.menuItem("File->Save As...").select();
936
		FileUtil.deleteFile(saveTo);
937
		submitSaveDlg(saveTo);	
938
		calc.menuItem("File->Close").select();
939
		openStartcenter();
940
941
		// Reopen and verify sorted result
942
		startcenter.menuItem("File->Open...").select();
943
		submitOpenDlg(saveTo);
944
		calc.waitForExistence(10, 2);
945
		assertArrayEquals("Original data", dataWithCurrencyFormats, CalcUtil.getCellTexts("$Sheet1.$A1:$A7"));
946
		assertArrayEquals("Saved sorted result exclude format", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("$Sheet2.$A1:$A7"));
947
	}
948
949
	/**
950
	 * Test sort options: multiple sort, data overlap
951
	 * @throws Exception
952
	 */
953
	@Test
954
	public void testSortOptionsMultipleSortDataOverlap() throws Exception{
955
956
		// Input some data
957
		String[][] data1 = new String[][] {
958
				{"D"},
959
				{"C"},
960
				{"B"},
961
				{"A"},
962
				{"E"},
963
		};
964
		String[][] expectedSortedResult1 = new String[][] {
965
				{"A"},
966
				{"B"},
967
				{"C"},
968
				{"D"},
969
				{"E"},
970
		};
971
		String[][] data2 = new String[][] {
972
				{"4"},
973
				{"2"},
974
				{"5"},
975
				{"1"},
976
				{"3"},
977
		};
978
		String[][] expectedSortedResultDataOverlap = new String[][] {
979
				{"A"},
980
				{"B"},
981
				{"C"},
982
				{"1"},
983
				{"2"},
984
				{"3"},
985
				{"4"},
986
				{"5"},
987
		};
988
		CalcUtil.selectRange("A1");
989
		typeKeys("D<down>C<down>B<down>A<down>E");
990
991
		// "Data->Sort...", uncheck "Range contains column labels", sort first by "Column A", "Ascending"
992
		calc.menuItem("Data->Sort...").select();
993
		SortOptionsPage.select();
994
		SortOptionsPage_RangeContainsColumnLabels.uncheck();
995
		SortPage.select();
996
		SortPage_By1.select("Column A");
997
		SortPage_Ascending1.check();
998
		SortPage.ok();		
999
1000
		// Verify sorted result
1001
		assertArrayEquals("Sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1002
1003
		// Uodo/redo
1004
		calc.menuItem("Edit->Undo: Sort").select();
1005
		assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5"));
1006
		calc.menuItem("Edit->Redo: Sort").select();
1007
		assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1008
1009
		// Input data2 into same sheet, data1 and data2 are not overlapped
1010
		CalcUtil.selectRange("G10");
1011
		typeKeys("4<down>2<down>5<down>1<down>3");
1012
1013
		// Focus on data2, "Data->Sort...", "Copy result to" partially overlap with data1, sort first by "Column G", "Ascending"
1014
		CalcUtil.selectRange("G10");
1015
		calc.menuItem("Data->Sort...").select();
1016
		SortOptionsPage.select();
1017
		SortOptionsPage_RangeContainsColumnLabels.uncheck();
1018
		SortOptionsPage_CopyResultTo.check();
1019
		SortOptionsPage_CopyResultToEdit.setText("A4");
1020
		SortPage.select();
1021
		SortPage_By1.select("Column G");
1022
		SortPage_Ascending1.check();
1023
		SortPage.ok();			
1024
1025
		// Verify sorted result
1026
		assertArrayEquals("Sorted result data overlap", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8"));
1027
1028
		// Save and close document
1029
		String saveTo = fullPath("temp/" + "SortOptionsMultipleSortDataOverlap.ods");
1030
		calc.menuItem("File->Save As...").select();
1031
		FileUtil.deleteFile(saveTo);
1032
		submitSaveDlg(saveTo);	
1033
		calc.menuItem("File->Close").select();
1034
		openStartcenter();
1035
1036
		// Reopen and verify sorted result
1037
		startcenter.menuItem("File->Open...").select();
1038
		submitOpenDlg(saveTo);
1039
		calc.waitForExistence(10, 2);
1040
		assertArrayEquals("Saved sorted result", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8"));
1041
		assertArrayEquals("Original data2", data2, CalcUtil.getCellTexts("G10:G14"));
1042
	}
1043
1044
	/**
1045
	 * Test sort options: multiple sort, no data overlap, sort parameter saved correctly
1046
	 * @throws Exception
1047
	 */
1048
	@Test
1049
	public void testSortOptionsMultipleSortSortParameterSaved() throws Exception{
1050
1051
		// Input some data
1052
		String[][] data1 = new String[][] {
1053
				{"D"},
1054
				{"C"},
1055
				{"B"},
1056
				{"A"},
1057
				{"E"},
1058
		};
1059
		String[][] expectedSortedResult1 = new String[][] {
1060
				{"A"},
1061
				{"B"},
1062
				{"C"},
1063
				{"D"},
1064
				{"E"},
1065
		};
1066
		String[][] data2 = new String[][] {
1067
				{"Numbers"},
1068
				{"4"},
1069
				{"2"},
1070
				{"5"},
1071
				{"1"},
1072
				{"3"},
1073
		};
1074
		String[][] expectedSortedResult2 = new String[][] {
1075
				{"Numbers"},
1076
				{"1"},
1077
				{"2"},
1078
				{"3"},
1079
				{"4"},
1080
				{"5"},
1081
		};
1082
		CalcUtil.selectRange("A1");
1083
		typeKeys("D<down>C<down>B<down>A<down>E");
1084
1085
		// "Data->Sort...", uncheck "Range contains column labels", check "Case sensitive" and "Include formats", sort first by "Column A", "Ascending"
1086
		calc.menuItem("Data->Sort...").select();
1087
		SortOptionsPage.select();
1088
		SortOptionsPage_RangeContainsColumnLabels.uncheck();
1089
		SortOptionsPage_CaseSensitive.check();
1090
		SortOptionsPage_IncludeFormats.check();
1091
		SortPage.select();
1092
		SortPage_By1.select("Column A");
1093
		SortPage_Ascending1.check();
1094
		SortPage.ok();		
1095
1096
		// Verify sorted result
1097
		assertArrayEquals("Sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1098
1099
		// Uodo/redo
1100
		calc.menuItem("Edit->Undo: Sort").select();
1101
		assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5"));
1102
		calc.menuItem("Edit->Redo: Sort").select();
1103
		assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1104
1105
		// Input data2 into same sheet, data1 and data2 are not overlapped
1106
		CalcUtil.selectRange("G10");
1107
		typeKeys("Numbers<down>4<down>2<down>5<down>1<down>3");
1108
1109
		// Focus on data2, "Data->Sort...", check "Range contains column labels", uncheck "Case sensitive" and "Include formats", sort first by "Numbers", "Ascending"
1110
		CalcUtil.selectRange("G10");
1111
		calc.menuItem("Data->Sort...").select();
1112
		SortOptionsPage.select();
1113
		SortOptionsPage_RangeContainsColumnLabels.check();
1114
		SortOptionsPage_CaseSensitive.uncheck();
1115
		SortOptionsPage_IncludeFormats.uncheck();
1116
		SortPage.select();
1117
		SortPage_By1.select("Numbers");
1118
		SortPage_Ascending1.check();
1119
		SortPage.ok();			
1120
1121
		// Verify sorted result
1122
		assertArrayEquals("Sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15"));
1123
1124
		// Uodo/redo
1125
		calc.menuItem("Edit->Undo: Sort").select();
1126
		assertArrayEquals("Undo sorted result", data2, CalcUtil.getCellTexts("G10:G15"));
1127
		calc.menuItem("Edit->Redo: Sort").select();
1128
		assertArrayEquals("Redo sorted result", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15"));
1129
1130
		// Open sort dialog, check its setting
1131
		calc.menuItem("Data->Sort...").select();
1132
		SortOptionsPage.select();
1133
		assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked());
1134
		assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked());
1135
		assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked());
1136
		SortOptionsPage.ok();		
1137
1138
		// Save and close document
1139
		String saveTo = fullPath("temp/" + "SortOptionsMultipleSortParameterSaved.ods");
1140
		calc.menuItem("File->Save As...").select();
1141
		FileUtil.deleteFile(saveTo);
1142
		submitSaveDlg(saveTo);	
1143
		calc.menuItem("File->Close").select();
1144
		openStartcenter();
1145
1146
		// Reopen and verify sorted result and sort parameters
1147
		startcenter.menuItem("File->Open...").select();
1148
		submitOpenDlg(saveTo);
1149
		calc.waitForExistence(10, 2);
1150
		assertArrayEquals("Saved sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1151
		assertArrayEquals("Saved sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15"));
1152
		calc.menuItem("Data->Sort...").select();
1153
		SortOptionsPage.select();
1154
		assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked());
1155
		assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked());
1156
		assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked());
1157
		SortOptionsPage.ok();	
1158
	}
1159
129
}
1160
}
(-)src/testcase/sc/datapilot/RenameFieldAutoUpdate.java (-186 lines)
Lines 1-186 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 * 
50
 *
51
 */
52
public class RenameFieldAutoUpdate {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while rename fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
		}
95
		
96
		DataPilotFieldSelect.click(1, 1);
97
		DataPilotFieldSelect.openContextMenu();
98
		menuItem("Add to Page").select();
99
		assertEquals("Locale",CalcUtil.getCellText("A1"));
100
		sleep(1);
101
		
102
		DataPilotFieldSelect.click(1,30);
103
		DataPilotFieldSelect.openContextMenu();
104
		menuItem("Add to Column").select();
105
		assertEquals("Name",CalcUtil.getCellText("A3"));
106
		sleep(1);
107
		
108
		DataPilotFieldSelect.click(1,50);
109
		DataPilotFieldSelect.openContextMenu();
110
		menuItem("Add to Row").select();
111
		assertEquals("Date",CalcUtil.getCellText("A4"));
112
		sleep(1);
113
		
114
		DataPilotFieldSelect.click(1,70);
115
		DataPilotFieldSelect.openContextMenu();
116
		menuItem("Add to Data by->Sum").select();
117
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
118
		assertEquals("266773",CalcUtil.getCellText("J23"));
119
		sleep(1);
120
		
121
		DataPilotPanePageArea.click(1,1);
122
		DataPilotPanePageArea.openContextMenu();
123
		menuItem("Field Option").select();
124
		DataPilotFieldDisplayNameEditBox.setText("New Locale");
125
		DataPilotFieldOptionFieldTabPageDialog.ok();
126
		assertEquals("New Locale",CalcUtil.getCellText("A1"));
127
		sleep(1);
128
		
129
		typeKeys("<$undo>");
130
		assertEquals("Locale",CalcUtil.getCellText("A1"));
131
		sleep(1);
132
		
133
		typeKeys("<$redo>");
134
		assertEquals("New Locale",CalcUtil.getCellText("A1"));
135
		sleep(1);
136
		
137
		CalcUtil.selectRange("B3");
138
		SpreadSheetCells.openContextMenu();
139
		menuItem("Field Option...").select();
140
		DataPilotFieldDisplayNameEditBox.setText("New Name");
141
		DataPilotFieldOptionFieldTabPageDialog.ok();
142
		assertEquals("New Name",CalcUtil.getCellText("B3"));
143
		sleep(1);
144
		
145
		typeKeys("<$undo>");
146
		assertEquals("Name",CalcUtil.getCellText("B3"));
147
		sleep(1);
148
		
149
		typeKeys("<$redo>");
150
		assertEquals("New Name",CalcUtil.getCellText("B3"));
151
		sleep(1);
152
		
153
		CalcUtil.selectRange("A4");
154
		SpreadSheetCells.openContextMenu();
155
		menuItem("Field Option...").select();
156
		DataPilotFieldDisplayNameEditBox.setText("New Date");
157
		DataPilotFieldOptionFieldTabPageDialog.ok();
158
		assertEquals("New Date",CalcUtil.getCellText("A4"));
159
		sleep(1);
160
		
161
		typeKeys("<$undo>");
162
		assertEquals("Date",CalcUtil.getCellText("A4"));
163
		sleep(1);
164
		
165
		typeKeys("<$redo>");
166
		assertEquals("New Date",CalcUtil.getCellText("A4"));
167
		sleep(1);
168
		
169
		DataPiloPaneDataArea.openContextMenu();
170
		menuItem("Field Option").select();
171
		DataPilotFieldDisplayNameEditBox.setText("New Sum - Order Number");
172
		DataPilotFieldOptionFieldTabPageDialog.ok();
173
		assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3"));
174
		sleep(1);
175
		
176
		typeKeys("<$undo>");
177
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
178
		sleep(1);
179
		
180
		typeKeys("<$redo>");
181
		assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3"));
182
		sleep(1);
183
		
184
	}
185
186
}
(-)src/testcase/sc/validity/ValidityUIErrorAlert.java (-86 lines)
Lines 1-86 Link Here
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.sc.validity;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import org.junit.After;
30
import static org.junit.Assert.*;
31
import static org.openoffice.test.vcl.Tester.*;
32
33
import org.junit.Before;
34
import org.junit.Rule;
35
import org.junit.Test;
36
37
38
import testlib.CalcUtil;
39
import testlib.Log;
40
41
42
public class ValidityUIErrorAlert {
43
	/**
44
	 * TestCapture helps us to do
45
	 * 1. Take a screenshot when failure occurs.
46
	 * 2. Collect extra data when OpenOffice crashes.
47
	 */	
48
	@Rule
49
	public Log LOG = new Log();
50
	
51
	/**
52
	 * initApp helps us to do 
53
	 * 1. Patch the OpenOffice to enable automation if necessary.
54
	 * 2. Start OpenOffice with automation enabled if necessary.
55
	 * 3. Reset OpenOffice to startcenter.
56
	 * 
57
	 * @throws java.lang.Exception
58
	 */
59
	@Before
60
	public void setUp() throws Exception {
61
		initApp();
62
	}
63
	
64
	/**
65
	 * test Data -> Validity - UI(Error Alert: Default status)
66
	 */
67
	@Test
68
	public void testValidityUIErrorAlert() {
69
		startcenter.menuItem("File->New->Spreadsheet").select();
70
		sleep(1);
71
		calc.menuItem("Data->Validity...").select();
72
		sleep(1);
73
		SC_ValidityErrorAlertTabPage.select();
74
		assertEquals(true,SC_ValidityErrorAlertActionList.isEnabled());
75
		assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText());
76
		assertEquals(true,SC_ValidityErrorMessageTitle.isEnabled());
77
		assertEquals("",SC_ValidityErrorMessageTitle.getText());
78
		assertEquals(true,SC_ValidityErrorMessage.isEnabled());
79
		assertEquals("",SC_ValidityErrorMessage.getText());
80
		SC_ValidityErrorAlertActionList.select("Macro");
81
		assertEquals(true,SC_ValidityErrorBrowseButton.isEnabled());
82
		
83
	}
84
85
}
86
(-)src/testcase/sc/sort/SortOptionsDirectionSortColumns.java (-125 lines)
Lines 1-125 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.sort;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.sleep;
34
import static org.openoffice.test.vcl.Tester.typeKeys;
35
36
import org.junit.Before;
37
import org.junit.Ignore;
38
import org.junit.Rule;
39
import org.junit.Test;
40
import org.openoffice.test.common.FileUtil;
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
/**
46
 *
47
 */
48
public class SortOptionsDirectionSortColumns {
49
	
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
56
	public Log LOG = new Log();
57
	
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	
71
	/**
72
	 * Test sort options: sort columns, direction "Left to right"
73
	 * @throws Exception
74
	 */
75
	@Test
76
	public void testSortOptionsDirectionSortColumns() throws Exception{
77
		
78
		// Create a new spreadsheet document
79
		startcenter.menuItem("File->New->Spreadsheet").select();
80
		sleep(3);
81
		
82
		// Input some data
83
		String[][] data = new String[][] {
84
				{"Units", "7", "27", "4", "12", "3", "6"},
85
		};
86
		String[][] expectedSortedResult = new String[][] {
87
				{"Units", "3", "4", "6", "7", "12", "27"},
88
		};
89
		CalcUtil.selectRange("A1");
90
		typeKeys("Units<right>7<right>27<right>4<right>12<right>3<right>6");
91
		
92
		// "Data->Sort...", check "Range contains column labels", "Left to right", sort first by"Units", "Ascending"
93
		calc.menuItem("Data->Sort...").select();
94
		SortOptionsPage.select();
95
		SortOptionsPage_RangeContainsColumnLabels.check();
96
		SortOptionsPage_LeftToRight.check();
97
		SortPage.select();
98
		SortPage_By1.select("Units");
99
		SortPage_Ascending1.check();
100
		SortPage.ok();		
101
		
102
		// Verify sorted result
103
		assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1"));
104
		
105
		// Uodo/redo
106
		calc.menuItem("Edit->Undo: Sort").select();
107
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:G1"));
108
		calc.menuItem("Edit->Redo: Sort").select();
109
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1"));
110
		
111
		// Save and close document
112
		String saveTo = fullPath("temp/" + "SortOptionsDirectionSortColumns.ods");
113
		calc.menuItem("File->Save As...").select();
114
		FileUtil.deleteFile(saveTo);
115
		submitSaveDlg(saveTo);	
116
		calc.menuItem("File->Close").select();
117
		openStartcenter();
118
		
119
		// Reopen and verify sorted result
120
		startcenter.menuItem("File->Open...").select();
121
		submitOpenDlg(saveTo);
122
		calc.waitForExistence(10, 2);
123
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1"));
124
	}
125
}
(-)src/testcase/sc/validity/ValiditySampleFile.java (-41 / +60 lines)
Lines 23-97 Link Here
23
23
24
package testcase.sc.validity;
24
package testcase.sc.validity;
25
25
26
import static testlib.AppUtil.fullPath;
27
import static testlib.AppUtil.initApp;
28
import static testlib.AppUtil.openStartcenter;
29
import static testlib.AppUtil.submitSaveDlg;
30
import static testlib.AppUtil.submitOpenDlg;
26
import static testlib.AppUtil.submitOpenDlg;
31
import static testlib.AppUtil.testFile;
27
import static testlib.AppUtil.testFile;
32
import static testlib.UIMap.startcenter;
28
import static testlib.AppUtil.typeKeys;
33
import static testlib.UIMap.*;
29
import static testlib.UIMap.*;
34
35
import java.io.File;
36
37
import static org.junit.Assert.*;
30
import static org.junit.Assert.*;
38
import static org.openoffice.test.vcl.Tester.*;
39
import static org.openoffice.test.vcl.Tester.typeKeys;
31
import static org.openoffice.test.vcl.Tester.typeKeys;
40
32
import org.junit.After;
41
import org.junit.Before;
33
import org.junit.Before;
42
import org.junit.Rule;
34
import org.junit.Rule;
43
import org.junit.Test;
35
import org.junit.Test;
44
import org.openoffice.test.common.FileUtil;
45
import org.openoffice.test.vcl.IDList;
46
import org.openoffice.test.vcl.widgets.VclMessageBox;
47
48
import testlib.CalcUtil;
36
import testlib.CalcUtil;
49
import testlib.Log;
37
import testlib.Log;
50
import testlib.UIMap;
51
38
52
public class FFCIgnoreBlank {
39
public class ValiditySampleFile {
53
		/**
40
54
	 * TestCapture helps us to doCalcUtil
55
	 * 1. Take a screenshot when failure occurs.
56
	 * 2. Collect extra data when OpenOffice crashes.
57
	 */	
58
	@Rule
41
	@Rule
59
	public Log LOG = new Log();
42
	public Log LOG = new Log();
60
	
43
61
	/**
62
	 * initApp helps us to do 
63
	 * 1. Patch the OpenOffice to enable automation if necessary.
64
	 * 2. Start OpenOffice with automation enabled if necessary.
65
	 * 3. Reset OpenOffice to startcenter.
66
	 * 
67
	 * @throws java.lang.Exception
68
	 */
69
	@Before
44
	@Before
70
	public void setUp() throws Exception {
45
	public void setUp() throws Exception {
71
		initApp();
46
		app.start();
72
	}
47
	}
73
	
48
49
	@After
50
	public void tearDown() throws Exception {
51
		app.close();
52
	}
53
74
	/**
54
	/**
75
	 * Test open MS 2003 spreadsheet with ignore blank validity.
55
	 * Test open MS 2003 spreadsheet with ignore blank validity.
76
	 * 
56
	 * 
77
	 * @throws Exception
57
	 * @throws Exception
78
	 */
58
	 */
79
	@Test
59
	@Test
80
	public void testFFCNotIgnoreBlank() throws Exception{
60
	public void testFFCIgnoreBlank() throws Exception{
81
		//open sample file
61
		// Open sample file
82
		String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls");
62
		String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls");
83
		startcenter.menuItem("File->Open").select();
63
		app.dispatch(".uno:Open", 3);
84
		submitOpenDlg(file);
64
		submitOpenDlg(file);
85
		
65
		calc.waitForExistence(10, 2);
66
86
		CalcUtil.selectRange("D5");
67
		CalcUtil.selectRange("D5");
87
		SC_CellInput.activate();
68
		SC_InputBar_Input.activate();
88
		for(int i=1;i<=10;i++)
69
		for(int i=1;i<=10;i++)
89
		typeKeys("<backspace>");
70
			typeKeys("<backspace>");
90
		typeKeys("<enter>");
71
		typeKeys("<enter>");
91
	
72
92
		assertEquals("",CalcUtil.getCellText("D5"));
73
		assertEquals("",CalcUtil.getCellText("D5"));
93
	}
74
	}
94
	
95
75
96
	
76
	/**
77
	 * Test open MS 2003 spreadsheet with ignore blank validity.
78
	 * 
79
	 * @throws Exception
80
	 */
81
	@Test
82
	public void testFFCNotIgnoreBlank() throws Exception{
83
		//open sample file
84
		String file = testFile("sc/FFC252FFCSC_XML_Datarange0205.xls");
85
		app.dispatch(".uno:Open", 3);
86
		submitOpenDlg(file);
87
		calc.waitForExistence(10, 2);
88
89
		CalcUtil.selectRange("F5");
90
		SC_InputBar_Input.activate();
91
		typeKeys("<backspace><enter>");
92
93
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
94
		ActiveMsgBox.ok();
95
		assertEquals("8",CalcUtil.getCellText("F5"));
96
	}
97
98
	/**
99
	 * test Cell is not locked after switch from validity cell to source cells
100
	 */
101
	@Test
102
	public void testNotLockCellFromValidityCell() {
103
		//open sample file on data path
104
		String file = testFile("sc/sampledata.ods");
105
		app.dispatch(".uno:Open", 3);
106
		submitOpenDlg(file);
107
		calc.waitForExistence(10, 2);
108
109
		CalcUtil.selectRange("Sheet1.F19");
110
		typeKeys("d<enter>");
111
		CalcUtil.selectRange("Sheet1.F17");
112
		typeKeys("Test<enter>");
113
114
		assertEquals("Test",CalcUtil.getCellText("F17"));
115
	}
97
}
116
}
(-)src/testcase/sc/validity/ValidityDialogSetting.java (-44 / +525 lines)
Lines 34-84 Link Here
34
34
35
import org.junit.Before;
35
import org.junit.Before;
36
import org.junit.Rule;
36
import org.junit.Rule;
37
import org.junit.Ignore;
37
import org.junit.Test;
38
import org.junit.Test;
38
import org.openoffice.test.vcl.IDList;
39
import org.openoffice.test.vcl.IDList;
39
import org.openoffice.test.vcl.widgets.VclMessageBox;
40
import org.openoffice.test.vcl.widgets.VclMessageBox;
40
41
41
42
import testlib.CalcUtil;
42
import testlib.CalcUtil;
43
import testlib.Log;
43
import testlib.Log;
44
44
45
45
46
public class AllowDateNotBetween {
46
public class ValidityDialogSetting {
47
	private static IDList idList = new IDList(new File("./ids"));
47
	private static IDList idList = new IDList(new File("./ids"));
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
49
	
49
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
50
	@Rule
56
	public Log LOG = new Log();
51
	public Log LOG = new Log();
57
	
52
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
53
	@Before
67
	public void setUp() throws Exception {
54
	public void setUp() throws Exception {
68
		initApp();
55
		app.start();
56
57
		// New a spreadsheet, select cell range, open Validity dialog
58
		startcenter.menuItem("File->New->Spreadsheet").select();
59
		CalcUtil.selectRange("Sheet1.A1:C5");
60
		calc.menuItem("Data->Validity...").select();
69
	}
61
	}
70
	
62
63
	@After
64
	public void tearDown() throws Exception {
65
		app.close();
66
	}
67
71
	/**
68
	/**
72
	 * test Allow not between Date type in Validity.
69
	 * test Allow not between Date type in Validity.
73
	 */
70
	 */
74
	@Test
71
	@Test
75
	public void testAllowDateNotBetween() {
72
	public void testAllowDateNotBetween() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
79
		CalcUtil.selectRange("Sheet1.A1:B5");
80
		calc.menuItem("Data->Validity...").select();
81
		sleep(1);
82
		SC_ValidityCriteriaTabpage.select();
73
		SC_ValidityCriteriaTabpage.select();
83
		SC_ValidityCriteriaAllowList.select("Date");
74
		SC_ValidityCriteriaAllowList.select("Date");
84
		SC_ValidityDecimalCompareOperator.select("not between");
75
		SC_ValidityDecimalCompareOperator.select("not between");
Lines 88-111 Link Here
88
		SC_ValidityShowErrorMessage.check();
79
		SC_ValidityShowErrorMessage.check();
89
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
80
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
90
		SC_ValidityErrorMessage.setText("Invalid value");
81
		SC_ValidityErrorMessage.setText("Invalid value");
91
		typeKeys("<tab>");
82
		SC_ValidityErrorAlertTabPage.ok();
92
		typeKeys("<enter>");	
83
93
		sleep(1);
94
				
95
		CalcUtil.selectRange("Sheet1.A1");
84
		CalcUtil.selectRange("Sheet1.A1");
96
		SC_CellInput.activate();
85
		SC_InputBar_Input.activate();
97
		typeKeys("12/31/07");
86
		typeKeys("12/31/07");
98
		typeKeys("<enter>");
87
		typeKeys("<enter>");
99
		assertEquals("12/31/07",CalcUtil.getCellText("Sheet1.A1"));
88
		assertEquals("12/31/07",CalcUtil.getCellText("Sheet1.A1"));
100
		
89
101
		CalcUtil.selectRange("Sheet1.A2");
90
		CalcUtil.selectRange("Sheet1.A2");
102
		SC_CellInput.activate();
91
		SC_InputBar_Input.activate();
103
		typeKeys("03/02/08");
92
		typeKeys("03/02/08");
104
		typeKeys("<enter>");
93
		typeKeys("<enter>");
105
		assertEquals("03/02/08",CalcUtil.getCellText("Sheet1.A2"));
94
		assertEquals("03/02/08",CalcUtil.getCellText("Sheet1.A2"));
106
		
95
107
		CalcUtil.selectRange("Sheet1.A3");
96
		CalcUtil.selectRange("Sheet1.A3");
108
		SC_CellInput.activate();
97
		SC_InputBar_Input.activate();
109
		typeKeys("01/01/08");
98
		typeKeys("01/01/08");
110
		typeKeys("<enter>");
99
		typeKeys("<enter>");
111
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
100
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
Lines 113-119 Link Here
113
		assertEquals("",CalcUtil.getCellText("Sheet1.A3"));
102
		assertEquals("",CalcUtil.getCellText("Sheet1.A3"));
114
103
115
		CalcUtil.selectRange("Sheet1.A4");
104
		CalcUtil.selectRange("Sheet1.A4");
116
		SC_CellInput.activate();
105
		SC_InputBar_Input.activate();
117
		typeKeys("03/01/08");
106
		typeKeys("03/01/08");
118
		typeKeys("<enter>");
107
		typeKeys("<enter>");
119
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
108
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
Lines 121-158 Link Here
121
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
110
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
122
111
123
		CalcUtil.selectRange("Sheet1.A5");
112
		CalcUtil.selectRange("Sheet1.A5");
124
		SC_CellInput.activate();
113
		SC_InputBar_Input.activate();
125
		typeKeys("01/02/08");
114
		typeKeys("01/02/08");
126
		typeKeys("<enter>");
115
		typeKeys("<enter>");
127
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
116
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
128
		ActiveMsgBox.ok();
117
		ActiveMsgBox.ok();
129
		assertEquals("",CalcUtil.getCellText("Sheet1.A5"));
118
		assertEquals("",CalcUtil.getCellText("Sheet1.A5"));
130
		
119
131
		CalcUtil.selectRange("Sheet1.B1");
120
		CalcUtil.selectRange("Sheet1.B1");
132
		SC_CellInput.activate();
121
		SC_InputBar_Input.activate();
133
		typeKeys("02/29/08");
122
		typeKeys("02/29/08");
134
		typeKeys("<enter>");
123
		typeKeys("<enter>");
135
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
124
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
136
		ActiveMsgBox.ok();
125
		ActiveMsgBox.ok();
137
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
126
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
138
		
127
139
		CalcUtil.selectRange("Sheet1.B2");
128
		CalcUtil.selectRange("Sheet1.B2");
140
		SC_CellInput.activate();
129
		SC_InputBar_Input.activate();
141
		typeKeys("test");
130
		typeKeys("test");
142
		typeKeys("<enter>");
131
		typeKeys("<enter>");
143
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
132
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
144
		ActiveMsgBox.ok();
133
		ActiveMsgBox.ok();
145
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
134
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
146
		
135
147
		CalcUtil.selectRange("Sheet1.B3");
136
		CalcUtil.selectRange("Sheet1.B3");
148
		SC_CellInput.activate();
137
		SC_InputBar_Input.activate();
149
		typeKeys("39448");
138
		typeKeys("39448");
150
		typeKeys("<enter>");
139
		typeKeys("<enter>");
151
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
140
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
152
		ActiveMsgBox.ok();
141
		ActiveMsgBox.ok();
153
		assertEquals("",CalcUtil.getCellText("Sheet1.B3"));
142
		assertEquals("",CalcUtil.getCellText("Sheet1.B3"));
154
		
143
	}
155
		}
156
144
145
	/**
146
	 * test Allow Decimal equal in Validity.
147
	 */
148
	@Test
149
	public void testAllowDecimalEqual() {
150
151
		SC_ValidityCriteriaTabpage.select();
152
		SC_ValidityCriteriaAllowList.select("Decimal");
153
		SC_ValidityDecimalCompareOperator.select("equal");
154
		SC_ValiditySourceInput.setText("0.33333333");
155
		SC_ValidityErrorAlertTabPage.select();
156
		SC_ValidityShowErrorMessage.check();
157
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
158
		SC_ValidityErrorMessage.setText("Invalid value");
159
		SC_ValidityErrorAlertTabPage.ok();
160
161
		CalcUtil.selectRange("Sheet1.A1");
162
		SC_InputBar_Input.activate();
163
		typeKeys("0.33333333");
164
		typeKeys("<enter>");
165
		assertEquals("0.33333333",CalcUtil.getCellText("Sheet1.A1"));
166
167
		CalcUtil.selectRange("Sheet1.A2");
168
		SC_InputBar_Input.activate();
169
		typeKeys("=1/3");
170
		typeKeys("<enter>");
171
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
172
		ActiveMsgBox.ok();
173
		assertEquals("",CalcUtil.getCellText("Sheet1.A2"));
174
175
		CalcUtil.selectRange("Sheet1.A3");
176
		SC_InputBar_Input.activate();
177
		typeKeys("0.3");
178
		typeKeys("<enter>");
179
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
180
		ActiveMsgBox.ok();
181
		assertEquals("",CalcUtil.getCellText("Sheet1.A3"));
182
183
		CalcUtil.selectRange("Sheet1.A4");
184
		SC_InputBar_Input.activate();
185
		typeKeys("0.333333333");
186
		typeKeys("<enter>");
187
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
188
		ActiveMsgBox.ok();
189
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
190
191
		CalcUtil.selectRange("Sheet1.B2");
192
		SC_InputBar_Input.activate();
193
		typeKeys("test");
194
		typeKeys("<enter>");
195
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
196
		ActiveMsgBox.ok();
197
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
198
	}
199
200
	/**
201
	 * test Allow Text length,  greater than or equal to  in Validity.
202
	 */
203
	@Test
204
	public void testAllowGreaterTextLength() {
205
206
		SC_ValidityCriteriaTabpage.select();
207
		SC_ValidityCriteriaAllowList.select("Text length");
208
		SC_ValidityDecimalCompareOperator.select("greater than or equal to");
209
		SC_ValiditySourceInput.setText("10");
210
		SC_ValidityErrorAlertTabPage.select();
211
		SC_ValidityShowErrorMessage.check();
212
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
213
		SC_ValidityErrorMessage.setText("Invalid value");
214
		SC_ValidityErrorAlertTabPage.ok();
215
216
		CalcUtil.selectRange("Sheet1.A1");
217
		SC_InputBar_Input.activate();
218
		typeKeys("testtesttesttest");
219
		typeKeys("<enter>");
220
		assertEquals("testtesttesttest",CalcUtil.getCellText("Sheet1.A1"));
221
222
		CalcUtil.selectRange("Sheet1.A2");
223
		SC_InputBar_Input.activate();
224
		typeKeys("test test ");
225
		typeKeys("<enter>");
226
		assertEquals("test test ",CalcUtil.getCellText("Sheet1.A2"));
227
228
		CalcUtil.selectRange("Sheet1.A4");
229
		SC_InputBar_Input.activate();
230
		typeKeys(" ");
231
		typeKeys("<enter>");
232
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
233
		ActiveMsgBox.ok();
234
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
235
236
		CalcUtil.selectRange("Sheet1.A3");
237
		SC_InputBar_Input.activate();
238
		typeKeys("Testatest");
239
		typeKeys("<enter>");
240
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
241
		ActiveMsgBox.ok();
242
		assertEquals("",CalcUtil.getCellText("Sheet1.A3"));
243
	}
244
245
	/**
246
	 * test Allow Text length,  less than  in Validity.
247
	 */
248
	@Ignore("Bug 93128")
249
	public void testAllowLessThanTextLength() {
250
251
		calc.menuItem("Data->Validity...").select();
252
253
		SC_ValidityCriteriaTabpage.select();
254
		SC_ValidityCriteriaAllowList.select("Text length");
255
		SC_ValidityDecimalCompareOperator.select("less than");
256
		SC_ValiditySourceInput.setText("10");
257
258
		SC_ValidityInputHelpTabPage.select();
259
		SC_ValidityInputHelpCheckbox.check();
260
		SC_ValidityInputHelpTitle.setText("Help Info Title");
261
		SC_ValidityHelpMessage.setText("help info");
262
263
		SC_ValidityErrorAlertTabPage.select();
264
		SC_ValidityShowErrorMessage.check();
265
		SC_ValidityErrorAlertActionList.select("Information");
266
		SC_ValidityErrorMessageTitle.setText("Notes to enter");
267
		SC_ValidityErrorMessage.setText("Invalid value");
268
		SC_ValidityErrorAlertTabPage.ok();
269
270
		CalcUtil.selectRange("Sheet1.A1");
271
		SC_InputBar_Input.activate();
272
		typeKeys("testtesttesttest<enter>");
273
		ActiveMsgBox.ok();
274
		assertEquals("testtesttesttest",CalcUtil.getCellText("Sheet1.A1"));
275
276
		CalcUtil.selectRange("Sheet1.A2");
277
		SC_InputBar_Input.activate();
278
		typeKeys("sfsafsddddddd<enter>");
279
		ActiveMsgBox.cancel();
280
		assertEquals("",CalcUtil.getCellText("Sheet1.A2"));
281
282
		CalcUtil.selectRange("Sheet1.A2");
283
		SC_InputBar_Input.activate();
284
		typeKeys("10<enter>");
285
		assertEquals("10",CalcUtil.getCellText("Sheet1.A2"));
286
287
		CalcUtil.selectRange("Sheet1.A3");
288
		SC_InputBar_Input.activate();
289
		typeKeys("ok<enter>");
290
		assertEquals("ok",CalcUtil.getCellText("Sheet1.A3"));
291
	}
292
293
	/**
294
	 * test Allow list.
295
	 */
296
	@Test
297
	public void testAllowListSpecialChar() {
298
299
		SC_ValidityCriteriaTabpage.select();
300
		SC_ValidityCriteriaAllowList.select("List");
301
		SC_ValidityEntries.focus();
302
		typeKeys("a");
303
		typeKeys("<enter>");
304
		typeKeys("b");
305
		SC_ValidityErrorAlertTabPage.select();
306
		SC_ValidityShowErrorMessage.check();
307
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
308
		SC_ValidityErrorMessage.setText("Invalid value");
309
		SC_ValidityCriteriaTabpage.select();
310
		SC_ValidityCriteriaTabpage.ok();
311
312
		calc.rightClick(1, 1);
313
		typeKeys("<shift s>");
314
		typeKeys("<down><enter>");	// Choose a
315
		assertEquals("a",CalcUtil.getCellText("Sheet1.A1"));
316
317
		CalcUtil.selectRange("Sheet1.B2");
318
		SC_InputBar_Input.activate();
319
		typeKeys("test");
320
		typeKeys("<enter>");
321
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
322
		ActiveMsgBox.ok();
323
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
324
	}
325
326
	/**
327
	 * test Allow time between  in Validity.
328
	 */
329
	@Test
330
	public void testAllowTimeBetween() {
331
332
		SC_ValidityCriteriaTabpage.select();
333
		SC_ValidityCriteriaAllowList.select("Time");
334
		SC_ValidityDecimalCompareOperator.select("between");
335
		SC_ValiditySourceInput.setText("27:00");
336
		SC_ValidityMaxValueInput.setText("21:00");
337
		SC_ValidityErrorAlertTabPage.select();
338
		SC_ValidityShowErrorMessage.check();
339
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
340
		SC_ValidityErrorMessage.setText("Invalid value");
341
		SC_ValidityErrorAlertTabPage.ok();
342
343
		CalcUtil.selectRange("Sheet1.A1");
344
		SC_InputBar_Input.activate();
345
		typeKeys("21:00");
346
		typeKeys("<enter>");
347
		assertEquals("09:00:00 PM",CalcUtil.getCellText("Sheet1.A1"));
348
349
		CalcUtil.selectRange("Sheet1.A2");
350
		SC_InputBar_Input.activate();
351
		typeKeys("27:00");
352
		typeKeys("<enter>");
353
		assertEquals("27:00:00",CalcUtil.getCellText("Sheet1.A2"));
354
355
		CalcUtil.selectRange("Sheet1.A3");
356
		SC_InputBar_Input.activate();
357
		typeKeys("1.125");
358
		typeKeys("<enter>");
359
		assertEquals("1.125",CalcUtil.getCellText("Sheet1.A3"));
360
361
		CalcUtil.selectRange("Sheet1.A4");
362
		SC_InputBar_Input.activate();
363
		typeKeys("0.875");
364
		typeKeys("<enter>");
365
		assertEquals("0.875",CalcUtil.getCellText("Sheet1.A4"));
366
367
		CalcUtil.selectRange("Sheet1.B1");
368
		SC_InputBar_Input.activate();
369
		typeKeys("03:00:01");
370
		typeKeys("<enter>");
371
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
372
		ActiveMsgBox.ok();
373
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
374
375
		CalcUtil.selectRange("Sheet1.B2");
376
		SC_InputBar_Input.activate();
377
		typeKeys("20:59:59");
378
		typeKeys("<enter>");
379
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
380
		ActiveMsgBox.ok();
381
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
382
383
		CalcUtil.selectRange("Sheet1.B3");
384
		SC_InputBar_Input.activate();
385
		typeKeys("1.126");
386
		typeKeys("<enter>");
387
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
388
		ActiveMsgBox.ok();
389
		assertEquals("",CalcUtil.getCellText("Sheet1.B3"));
390
391
		CalcUtil.selectRange("Sheet1.B4");
392
		SC_InputBar_Input.activate();
393
		typeKeys("0.874");
394
		typeKeys("<enter>");
395
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
396
		ActiveMsgBox.ok();
397
		assertEquals("",CalcUtil.getCellText("Sheet1.B4"));
398
399
		CalcUtil.selectRange("Sheet1.C1");
400
		SC_InputBar_Input.activate();
401
		typeKeys("test");
402
		typeKeys("<enter>");
403
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
404
		ActiveMsgBox.ok();
405
		assertEquals("",CalcUtil.getCellText("Sheet1.C1"));
406
407
		CalcUtil.selectRange("Sheet1.C2");
408
		SC_InputBar_Input.activate();
409
		typeKeys("24:00");
410
		typeKeys("<enter>");
411
		assertEquals("24:00:00",CalcUtil.getCellText("Sheet1.C2"));
412
413
		CalcUtil.selectRange("Sheet1.C3");
414
		SC_InputBar_Input.activate();
415
		typeKeys("12:00");
416
		typeKeys("<enter>");
417
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
418
		ActiveMsgBox.ok();
419
		assertEquals("",CalcUtil.getCellText("Sheet1.C3"));
420
	}
421
422
	/**
423
	 * test Allow time Greater than and equal to  in Validity.
424
	 */
425
	@Test
426
	public void testAllowTimeGreaterThan() {
427
428
		SC_ValidityCriteriaTabpage.select();
429
		SC_ValidityCriteriaAllowList.select("Time");
430
		SC_ValidityDecimalCompareOperator.select("greater than or equal to");
431
		SC_ValiditySourceInput.setText("8:00");
432
433
		SC_ValidityErrorAlertTabPage.select();
434
		SC_ValidityShowErrorMessage.check();
435
		SC_ValidityErrorAlertActionList.select("Warning");
436
437
		SC_ValidityErrorMessageTitle.setText("warning to enter");
438
		SC_ValidityErrorMessage.setText("Invalid value");
439
		SC_ValidityErrorAlertTabPage.ok();
440
441
		CalcUtil.selectRange("Sheet1.A1");
442
		SC_InputBar_Input.activate();
443
		typeKeys("7:30");
444
		typeKeys("<enter>");
445
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
446
		ActiveMsgBox.ok();
447
		assertEquals("07:30:00 AM",CalcUtil.getCellText("Sheet1.A1"));
448
449
		CalcUtil.selectRange("Sheet1.A2");
450
		SC_InputBar_Input.activate();
451
		typeKeys("6:00");
452
		typeKeys("<enter>");
453
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
454
		ActiveMsgBox.cancel();
455
		assertEquals("",CalcUtil.getCellText("Sheet1.A2"));
456
457
		CalcUtil.selectRange("Sheet1.A3");
458
		SC_InputBar_Input.activate();
459
		typeKeys("8:00");
460
		typeKeys("<enter>");
461
		assertEquals("08:00:00 AM",CalcUtil.getCellText("Sheet1.A3"));
462
	}
463
464
	/**
465
	 * test Allow whole number, less than or equal to in Validity.
466
	 */
467
	@Test
468
	public void testAllowWholeNumLessThan() {
469
470
		SC_ValidityCriteriaTabpage.select();
471
		SC_ValidityCriteriaAllowList.select("Whole Numbers");
472
		SC_ValidityDecimalCompareOperator.select("less than or equal");
473
		SC_ValiditySourceInput.setText("100");
474
		SC_ValidityErrorAlertTabPage.select();
475
		SC_ValidityShowErrorMessage.check();
476
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
477
		SC_ValidityErrorMessage.setText("Invalid value");
478
		SC_ValidityErrorAlertTabPage.ok();
479
480
		CalcUtil.selectRange("Sheet1.A1");
481
		SC_InputBar_Input.activate();
482
		typeKeys("99");
483
		typeKeys("<enter>");
484
		assertEquals("99",CalcUtil.getCellText("Sheet1.A1"));
485
486
		CalcUtil.selectRange("Sheet1.A2");
487
		SC_InputBar_Input.activate();
488
		typeKeys("100");
489
		typeKeys("<enter>");
490
		assertEquals("100",CalcUtil.getCellText("Sheet1.A2"));
491
492
		CalcUtil.selectRange("Sheet1.B1");
493
		SC_InputBar_Input.activate();
494
		typeKeys("101");
495
		typeKeys("<enter>");
496
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
497
		ActiveMsgBox.ok();
498
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
499
500
		CalcUtil.selectRange("Sheet1.B2");
501
		SC_InputBar_Input.activate();
502
		typeKeys("45.5");
503
		typeKeys("<enter>");
504
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
505
		ActiveMsgBox.ok();
506
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
507
508
		CalcUtil.selectRange("Sheet1.C1");
509
		SC_InputBar_Input.activate();
510
		typeKeys("test");
511
		typeKeys("<enter>");
512
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
513
		ActiveMsgBox.ok();
514
		assertEquals("",CalcUtil.getCellText("Sheet1.C1"));
515
	}
516
517
	/**
518
	 * test default message of Error Alert in Validity.
519
	 */
520
	@Test
521
	public void testDefaultErrorAlertMessage() {
522
523
		SC_ValidityCriteriaTabpage.select();
524
		SC_ValidityCriteriaAllowList.select("Decimal");
525
		SC_ValidityDecimalCompareOperator.select("equal");
526
		SC_ValiditySourceInput.setText("1");
527
528
		SC_ValidityErrorAlertTabPage.select();
529
		SC_ValidityShowErrorMessage.check();
530
		SC_ValidityErrorAlertActionList.select("Stop");
531
		SC_ValidityErrorAlertTabPage.ok();
532
533
		CalcUtil.selectRange("Sheet1.A1");
534
		SC_InputBar_Input.activate();
535
		typeKeys("13");
536
		typeKeys("<enter>");
537
		assertEquals("OpenOffice.org Calc",ActiveMsgBox.getCaption());
538
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
539
		ActiveMsgBox.ok();
540
		assertEquals("",CalcUtil.getCellText("Sheet1.A1"));
541
	}
542
543
	/**
544
	 * test uncheck Error Alert in Validity.
545
	 */
546
	@Test
547
	public void testUncheckErrorAlert() {
548
549
		SC_ValidityCriteriaTabpage.select();
550
		SC_ValidityCriteriaAllowList.select("Decimal");
551
		SC_ValidityDecimalCompareOperator.select("equal");
552
		SC_ValiditySourceInput.setText("1");
553
554
		SC_ValidityErrorAlertTabPage.select();
555
		SC_ValidityShowErrorMessage.uncheck();
556
		SC_ValidityErrorAlertActionList.select("Stop");
557
		SC_ValidityErrorAlertTabPage.ok();
558
559
		CalcUtil.selectRange("Sheet1.A1");
560
		SC_InputBar_Input.activate();
561
		typeKeys("13");
562
		typeKeys("<enter>");
563
		assertEquals("13",CalcUtil.getCellText("Sheet1.A1"));
564
	}
565
566
	/**
567
	 * test Cell range source picker in Validity. Input from Edit Box.
568
	 */
569
	@Test
570
	public void testValidityCellRangeSourcePicker() {
571
572
		SC_ValidityCriteriaTabpage.select();
573
		SC_ValidityCriteriaAllowList.select("Cell range");
574
		SC_ValiditySourcePicker.click();
575
		assertEquals(false,SC_ValidityCriteriaAllowList.exists());
576
		SC_ValiditySourceInput.setText("$Sheet1.$E$2:$G$5");
577
		SC_ValiditySourcePicker.click();
578
		assertEquals(true,SC_ValidityCriteriaAllowList.exists());
579
580
		SC_ValidityErrorAlertTabPage.select();
581
		SC_ValidityShowErrorMessage.check();
582
		SC_ValidityErrorAlertActionList.select("Stop");
583
		SC_ValidityErrorAlertTabPage.ok();
584
585
		// calc.focus();
586
		CalcUtil.selectRange("Sheet1.E2");
587
		SC_InputBar_Input.activate();
588
		typeKeys("test");
589
		typeKeys("<enter>");
590
591
		CalcUtil.selectRange("Sheet1.A1");
592
		SC_InputBar_Input.activate();
593
		typeKeys("test32");
594
		typeKeys("<enter>");
595
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
596
		ActiveMsgBox.ok();
597
		assertEquals("",CalcUtil.getCellText("Sheet1.A1"));		
598
599
		CalcUtil.selectRange("Sheet1.B1");
600
		SC_InputBar_Input.activate();
601
		typeKeys("test");
602
		typeKeys("<enter>");
603
		assertEquals("test",CalcUtil.getCellText("Sheet1.B1"));
604
	}
605
606
	/**
607
	 * test Allow Blank cell Checkbox in Validity.
608
	 */
609
	@Test
610
	public void testAllowBlankCells() {
611
		SC_ValidityCriteriaTabpage.select();
612
		SC_ValidityCriteriaAllowList.select("Cell range");
613
		SC_ValiditySourceInput.setText("$E$1:$E$5");
614
		SC_ValidityAllowBlankCells.check();
615
		SC_ValidityCriteriaTabpage.ok();
616
617
		CalcUtil.selectRange("Sheet1.E1");
618
		typeKeys("A<enter>A<enter>A<enter>A<enter>A<enter>");
619
620
		CalcUtil.selectRange("Sheet1.A1");
621
		typeKeys("A<enter>");
622
		CalcUtil.selectRange("Sheet1.D1");
623
		SC_InputBar_Input.activate();
624
		typeKeys("<backspace><enter>");
625
		assertEquals("",CalcUtil.getCellText("Sheet1.D1"));
626
627
		CalcUtil.selectRange("Sheet1.B1");
628
		calc.menuItem("Data->Validity...").select();
629
		SC_ValidityCriteriaTabpage.select();
630
		SC_ValidityAllowBlankCells.uncheck();
631
		typeKeys("<enter>");
632
633
		CalcUtil.selectRange("Sheet1.B1");
634
		SC_InputBar_Input.activate();
635
		typeKeys("<backspace><enter>");
636
		typeKeys("<enter>");
637
	}
157
}
638
}
158
639
(-)src/testcase/sc/validity/ValidityUIAllowDecimal.java (-120 lines)
Lines 1-120 Link Here
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.sc.validity;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.io.File;
30
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
35
import org.junit.Before;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.vcl.IDList;
39
import org.openoffice.test.vcl.widgets.VclMessageBox;
40
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
46
public class ValidityUIAllowDecimal {
47
	private static IDList idList = new IDList(new File("./ids"));
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
49
	
50
	/**
51
	 * TestCapture helps us to do
52
	 * 1. Take a screenshot when failure occurs.
53
	 * 2. Collect extra data when OpenOffice crashes.
54
	 */	
55
	@Rule
56
	public Log LOG = new Log();
57
	
58
	/**
59
	 * initApp helps us to do 
60
	 * 1. Patch the OpenOffice to enable automation if necessary.
61
	 * 2. Start OpenOffice with automation enabled if necessary.
62
	 * 3. Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	
71
	/**
72
	 * test Allow type Decimal in validity
73
	 */
74
	@Test
75
	public void testValidityUIAllowDecimal() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
79
		CalcUtil.selectRange("Sheet1.A1:C2");
80
		calc.menuItem("Data->Validity...").select();
81
		sleep(1);
82
		SC_ValidityCriteriaTabpage.select();
83
		SC_ValidityCriteriaAllowList.select("Decimal");
84
		SC_ValidityDecimalCompareOperator.select("equal");
85
		SC_ValiditySourceInput.setText("1.55555");
86
		typeKeys("<enter>");
87
		
88
		CalcUtil.selectRange("Sheet1.A1");
89
		SC_CellInput.activate();
90
		typeKeys("1.5");
91
		typeKeys("<enter>");
92
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
93
		ActiveMsgBox.focus();
94
		typeKeys("<enter>");
95
		
96
		
97
		CalcUtil.selectRange("Sheet1.A1:C2");
98
		calc.menuItem("Data->Validity...").select();
99
		sleep(1);
100
		SC_ValidityDecimalCompareOperator.select("between");
101
		SC_ValiditySourceInput.setText("5");
102
		SC_ValidityMaxValueInput.setText("1");
103
		typeKeys("<enter>");
104
		
105
		CalcUtil.selectRange("Sheet1.A1");
106
		SC_CellInput.activate();
107
		typeKeys("10");
108
		typeKeys("<enter>");
109
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
110
		
111
		
112
		
113
		
114
		
115
		
116
	}
117
118
}
119
120
(-)src/testcase/sc/datapilot/MoveFieldToOtherAreaDiscardChange.java (-158 lines)
Lines 1-158 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.MenuItem;
33
import java.awt.Rectangle;
34
import java.io.File;
35
36
import org.junit.After;
37
import static org.junit.Assert.*;
38
import static org.openoffice.test.vcl.Tester.*;
39
40
import org.junit.Before;
41
import org.junit.Rule;
42
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
50
/**
51
 *
52
 *
53
 */
54
public class MoveFieldToOtherAreaDiscardChange {
55
	/**
56
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
57
	 * Collect extra data when OpenOffice crashes.
58
	 */
59
	@Rule
60
	public Log LOG = new Log();
61
62
	/**
63
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
64
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
65
	 * Reset OpenOffice to startcenter.
66
	 * 
67
	 * @throws java.lang.Exception
68
	 */
69
	@Before
70
	public void setUp() throws Exception {
71
		initApp();
72
	}
73
	/**
74
	 * 
75
	 * Verify that DP panel will be synchronized with table while move fields on panel.
76
	 */
77
	@Test
78
	public void test() {
79
		String file = testFile("source_data01.ods");
80
		startcenter.menuItem("File->Open...").select();
81
		submitOpenDlg(file);
82
		sleep(2);
83
		CalcUtil.selectRange("A1:E27");
84
		calc.menuItem("Data->DataPilot->Start...").select();
85
		CreateDataPilotTableDialog.ok();
86
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
87
			DataPilotAutomaticallyUpdateCheckBox.check();
88
			
89
		}
90
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
91
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
92
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
93
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
94
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
95
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
96
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
97
		sleep(1);
98
		
99
		DataPilotFieldSelect.click(1, 1);
100
		DataPilotFieldSelect.openContextMenu();
101
		menuItem("Add to Column").select();
102
		assertEquals("Locale",CalcUtil.getCellText("A1"));
103
		sleep(1);
104
		
105
		DataPilotFieldSelect.click(1,30);
106
		DataPilotFieldSelect.openContextMenu();
107
		menuItem("Add to Column").select();
108
		assertEquals("Name",CalcUtil.getCellText("B1"));
109
		sleep(1);
110
		
111
		DataPilotFieldSelect.click(1,50);
112
		DataPilotFieldSelect.openContextMenu();
113
		menuItem("Add to Row").select();
114
		assertEquals("Date",CalcUtil.getCellText("A3"));
115
		sleep(1);
116
		
117
		DataPilotFieldSelect.click(1,70);
118
		DataPilotFieldSelect.openContextMenu();
119
		menuItem("Add to Row").select();
120
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
121
		sleep(1);
122
		
123
		DataPilotFieldSelect.click(1,90);
124
		DataPilotFieldSelect.openContextMenu();
125
		menuItem("Add to Data by->Sum").select();
126
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
127
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
128
		sleep(1);
129
		
130
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
131
		
132
		DataPilotPaneRowArea.drag(1,1, 1, -50);
133
		assertEquals("Date",CalcUtil.getCellText("A3"));
134
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
135
		sleep(1);
136
		
137
		CalcUtil.selectRange("B33");
138
		ActiveMsgBox.yes();
139
		assertEquals("Date",CalcUtil.getCellText("D1"));
140
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
141
		sleep(1);
142
		
143
		DataPilotColumnArea.click(1,50);
144
		DataPilotColumnArea.openContextMenu();
145
		menuItem("Move to Row").select();
146
		assertEquals("Date",CalcUtil.getCellText("D1"));
147
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
148
		
149
		CalcUtil.selectRange("B33");
150
		ActiveMsgBox.yes();
151
		assertEquals("Date",CalcUtil.getCellText("B3"));
152
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
153
		sleep(1);
154
		
155
		DataPilotAutomaticallyUpdateCheckBox.check();
156
	}
157
158
}
(-)src/testcase/sc/datapilot/DataPilotAddFieldsAutoUpdate.java (-140 lines)
Lines 1-140 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
/**
48
 *
49
 *
50
 */
51
public class DataPilotAddFieldsAutoUpdate {
52
	/**
53
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
54
	 * Collect extra data when OpenOffice crashes.
55
	 */
56
	@Rule
57
	public Log LOG = new Log();
58
59
	/**
60
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
61
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
62
	 * Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	/**
71
	 * 
72
	 * Verify that DP panel will be synchronized with table while add fields on panel.
73
	 */
74
	@Test
75
	public void test() {
76
		//open the sample file Create DataPilotTable and verify the content
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
			
95
		}
96
		sleep(1);
97
		
98
		//Add field into every area
99
		DataPilotFieldSelect.click(1, 30);
100
		DataPilotFieldSelect.openContextMenu();
101
		menuItem("Add to Column").select();
102
		assertEquals("Name",CalcUtil.getCellText("A1"));
103
		sleep(1);
104
		
105
		DataPilotFieldSelect.click(1,50);
106
		DataPilotFieldSelect.openContextMenu();
107
		menuItem("Add to Row").select();
108
		assertEquals("Date",CalcUtil.getCellText("A2"));
109
		sleep(1);
110
		
111
		DataPilotFieldSelect.drag(1, 1, 184, 80);
112
		assertEquals("Locale",CalcUtil.getCellText("A1"));
113
		sleep(1);
114
		
115
		typeKeys("<$undo>");
116
		assertEquals("",CalcUtil.getCellText("A1"));
117
		sleep(1);
118
		
119
		typeKeys("<$redo>");
120
		assertEquals("Locale",CalcUtil.getCellText("A1"));
121
		sleep(1);
122
		
123
		DataPilotFieldSelect.click(1,70);
124
		DataPilotFieldSelect.openContextMenu();
125
		menuItem("Add to Data by->Sum").select();
126
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
127
		assertEquals("266773",CalcUtil.getCellText("J23"));
128
		sleep(1);
129
		
130
		typeKeys("<$undo>");
131
		assertEquals("",CalcUtil.getCellText("A3"));
132
		sleep(1);
133
		
134
		typeKeys("<$redo>");
135
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
136
		assertEquals("266773",CalcUtil.getCellText("J23"));
137
		sleep(1);
138
	}
139
140
}
(-)src/testcase/sc/datapilot/MoveFieldToOtherAreaAutoUpdate.java (-153 lines)
Lines 1-153 Link Here
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
/**
25
 * 
26
 */
27
package testcase.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.MenuItem;
33
import java.awt.Rectangle;
34
import java.io.File;
35
36
import org.junit.After;
37
import static org.junit.Assert.*;
38
import static org.openoffice.test.vcl.Tester.*;
39
40
import org.junit.Before;
41
import org.junit.Rule;
42
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
50
/**
51
 * 
52
 *
53
 */
54
public class MoveFieldToOtherAreaAutoUpdate {
55