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
	/**
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
		DataPilotPaneRowArea.drag(1,1, 1, -50);
131
		assertEquals("Date",CalcUtil.getCellText("D1"));
132
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
133
		sleep(1);
134
		
135
		DataPilotColumnArea.click(1,50);
136
		DataPilotColumnArea.openContextMenu();
137
		menuItem("Move to Row").select();
138
		assertEquals("Date",CalcUtil.getCellText("B3"));
139
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
140
		sleep(1);
141
		
142
		typeKeys("<$undo>");
143
		assertEquals("Date",CalcUtil.getCellText("D1"));
144
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
145
		sleep(1);
146
		
147
		typeKeys("<$redo>");
148
		assertEquals("Date",CalcUtil.getCellText("B3"));
149
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
150
		
151
	}
152
153
}
(-)src/testcase/sc/datapilot/DataPivotTable.java (-36 / +1544 lines)
Lines 28-84 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 java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
31
import org.junit.After;
36
import static org.junit.Assert.*;
32
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
33
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
34
import org.junit.Before;
35
import org.junit.Ignore;
40
import org.junit.Rule;
36
import org.junit.Rule;
41
import org.junit.Test;
37
import org.openoffice.test.common.SystemUtil;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
38
import testlib.CalcUtil;
46
import testlib.Log;
39
import testlib.Log;
40
47
/**
41
/**
48
 * 
42
 * Test Data->Pivot Table
49
 *
43
 * Test cases in this class are unavailable. Because these test cases are based on symphony.
44
 * DataPilot of symphony is totally different from PivotTable of AOO.
45
 * Keep this class to track the test point.
46
 * TODO: Add test cases about Pivot Table.
50
 */
47
 */
51
public class CopyPasteDataPilotTable {
48
public class DataPivotTable {
52
	/**
49
53
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
54
	 * Collect extra data when OpenOffice crashes.
55
	 */
56
	@Rule
50
	@Rule
57
	public Log LOG = new Log();
51
	public Log LOG = new Log();
58
52
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
53
	@Before
67
	public void setUp() throws Exception {
54
	public void setUp() throws Exception {
68
		initApp();
55
		app.start();
69
	}
56
	}
57
58
	@After
59
	public void tearDown() throws Exception {
60
		app.close();
61
	}
62
70
	/**
63
	/**
71
	 * 
64
	 * 
72
	 * Verify copy and paste Data Pilot Table
65
	 * Verify copy and paste Data Pilot Table
73
	 */
66
	 */
74
	@Test
67
	@Ignore("DataPilot in symphony is totally not the same in AOO")
75
	public void test() {
68
	public void testCopyPasteDataPilotTable() {
76
		//Open the sample file
69
		//Open the sample file
77
		String file = testFile("source_data01.ods");
70
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
71
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
72
		submitOpenDlg(file);
80
		sleep(2);
73
		sleep(2);
81
		
74
82
		//Create DataPilotTable and verify the content
75
		//Create DataPilotTable and verify the content
83
		CalcUtil.selectRange("A1:E27");
76
		CalcUtil.selectRange("A1:E27");
84
		calc.menuItem("Data->DataPilot->Start...").select();		
77
		calc.menuItem("Data->DataPilot->Start...").select();		
Lines 90-130 Link Here
90
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
83
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
91
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
84
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
92
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
85
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
93
		
86
94
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
87
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
95
			DataPilotAutomaticallyUpdateCheckBox.check();
88
			DataPilotAutomaticallyUpdateCheckBox.check();
96
		}
89
		}
97
		
90
98
		//Add field into every area
91
		//Add field into every area
99
		DataPilotFieldSelect.click(1, 1);
92
		DataPilotFieldSelect.click(1, 1);
100
		DataPilotFieldSelect.openContextMenu();
93
		DataPilotFieldSelect.openContextMenu();
101
		menuItem("Add to Page").select();
94
		menuItem("Add to Page").select();
102
		assertEquals("Locale",CalcUtil.getCellText("A1"));
95
		assertEquals("Locale",CalcUtil.getCellText("A1"));
103
		sleep(1);
96
		sleep(1);
104
		
97
105
		DataPilotFieldSelect.click(1,30);
98
		DataPilotFieldSelect.click(1,30);
106
		DataPilotFieldSelect.openContextMenu();
99
		DataPilotFieldSelect.openContextMenu();
107
		menuItem("Add to Column").select();
100
		menuItem("Add to Column").select();
108
		assertEquals("Name",CalcUtil.getCellText("A3"));
101
		assertEquals("Name",CalcUtil.getCellText("A3"));
109
		sleep(1);
102
		sleep(1);
110
		
103
111
		DataPilotFieldSelect.click(1,50);
104
		DataPilotFieldSelect.click(1,50);
112
		DataPilotFieldSelect.openContextMenu();
105
		DataPilotFieldSelect.openContextMenu();
113
		menuItem("Add to Row").select();
106
		menuItem("Add to Row").select();
114
		assertEquals("Date",CalcUtil.getCellText("A4"));
107
		assertEquals("Date",CalcUtil.getCellText("A4"));
115
		sleep(1);
108
		sleep(1);
116
		
109
117
		DataPilotFieldSelect.click(1,70);
110
		DataPilotFieldSelect.click(1,70);
118
		DataPilotFieldSelect.openContextMenu();
111
		DataPilotFieldSelect.openContextMenu();
119
		menuItem("Add to Data by->Sum").select();
112
		menuItem("Add to Data by->Sum").select();
120
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
113
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
121
		assertEquals("266773",CalcUtil.getCellText("J23"));
114
		assertEquals("266773",CalcUtil.getCellText("J23"));
122
		sleep(1);
115
		sleep(1);
123
		
116
124
		//Copy and paste the data pilot table and verify the content
117
		//Copy and paste the data pilot table and verify the content
125
		CalcUtil.selectRange("A1:J24");
118
		CalcUtil.selectRange("A1:J24");
126
		typeKeys("<$copy>");
119
		typeKeys("<$copy>");
127
		
120
128
		CalcUtil.selectRange("A26");
121
		CalcUtil.selectRange("A26");
129
		typeKeys("<$paste>");
122
		typeKeys("<$paste>");
130
		assertEquals("Locale",CalcUtil.getCellText("A26"));
123
		assertEquals("Locale",CalcUtil.getCellText("A26"));
Lines 135-141 Link Here
135
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
128
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
136
		assertEquals("266773",CalcUtil.getCellText("J48"));
129
		assertEquals("266773",CalcUtil.getCellText("J48"));
137
		sleep(1);
130
		sleep(1);
138
		
131
139
		CalcUtil.selectRange("A1:J24");
132
		CalcUtil.selectRange("A1:J24");
140
		typeKeys("<$copy>");
133
		typeKeys("<$copy>");
141
		CalcUtil.selectRange("$A.$A29");
134
		CalcUtil.selectRange("$A.$A29");
Lines 147-153 Link Here
147
		assertEquals("Total Result",CalcUtil.getCellText("A51"));
140
		assertEquals("Total Result",CalcUtil.getCellText("A51"));
148
		assertEquals("Total Result",CalcUtil.getCellText("J32"));
141
		assertEquals("Total Result",CalcUtil.getCellText("J32"));
149
		assertEquals("266773",CalcUtil.getCellText("J51"));
142
		assertEquals("266773",CalcUtil.getCellText("J51"));
150
		
151
	}
143
	}
152
144
145
	/**
146
	 * 
147
	 * Verify that DP panel will be synchronized with table while add fields on panel.
148
	 */
149
	@Ignore("DataPilot in symphony is totally not the same in AOO")
150
	public void testDataPilotAddFieldsAutoUpdate() {
151
		//open the sample file Create DataPilotTable and verify the content
152
		String file = testFile("source_data01.ods");
153
		startcenter.menuItem("File->Open...").select();
154
		submitOpenDlg(file);
155
		sleep(2);
156
		CalcUtil.selectRange("A1:E27");
157
		calc.menuItem("Data->DataPilot->Start...").select();
158
		CreateDataPilotTableDialog.ok();
159
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
160
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
161
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
162
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
163
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
164
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
165
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
166
167
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
168
			DataPilotAutomaticallyUpdateCheckBox.check();
169
170
		}
171
		sleep(1);
172
173
		//Add field into every area
174
		DataPilotFieldSelect.click(1, 30);
175
		DataPilotFieldSelect.openContextMenu();
176
		menuItem("Add to Column").select();
177
		assertEquals("Name",CalcUtil.getCellText("A1"));
178
		sleep(1);
179
180
		DataPilotFieldSelect.click(1,50);
181
		DataPilotFieldSelect.openContextMenu();
182
		menuItem("Add to Row").select();
183
		assertEquals("Date",CalcUtil.getCellText("A2"));
184
		sleep(1);
185
186
		DataPilotFieldSelect.drag(1, 1, 184, 80);
187
		assertEquals("Locale",CalcUtil.getCellText("A1"));
188
		sleep(1);
189
190
		typeKeys("<$undo>");
191
		assertEquals("",CalcUtil.getCellText("A1"));
192
		sleep(1);
193
194
		typeKeys("<$redo>");
195
		assertEquals("Locale",CalcUtil.getCellText("A1"));
196
		sleep(1);
197
198
		DataPilotFieldSelect.click(1,70);
199
		DataPilotFieldSelect.openContextMenu();
200
		menuItem("Add to Data by->Sum").select();
201
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
202
		assertEquals("266773",CalcUtil.getCellText("J23"));
203
		sleep(1);
204
205
		typeKeys("<$undo>");
206
		assertEquals("",CalcUtil.getCellText("A3"));
207
		sleep(1);
208
209
		typeKeys("<$redo>");
210
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
211
		assertEquals("266773",CalcUtil.getCellText("J23"));
212
		sleep(1);
213
	}
214
215
	/**
216
	 * 
217
	 * Verify that DP panel will be synchronized with table while add fields on panel.
218
	 */
219
	@Ignore("DataPilot in symphony is totally not the same in AOO")
220
	public void testDataPilotAddFieldsManualUpdate() {
221
		//open the sample file Create DataPilotTable and verify the content
222
		String file = testFile("source_data01.ods");
223
		startcenter.menuItem("File->Open...").select();
224
		submitOpenDlg(file);
225
		sleep(2);
226
		CalcUtil.selectRange("A1:E27");
227
		calc.menuItem("Data->DataPilot->Start...").select();
228
		CreateDataPilotTableDialog.ok();
229
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
230
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
231
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
232
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
233
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
234
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
235
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
236
237
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
238
			DataPilotAutomaticallyUpdateCheckBox.check();
239
240
		}
241
242
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
243
244
		sleep(1);
245
		DataPilotFieldSelect.click(1, 30);
246
		DataPilotFieldSelect.openContextMenu();
247
		menuItem("Add to Column").select();
248
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
249
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
250
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
251
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
252
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
253
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
254
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
255
		sleep(1);
256
257
		DataPilotFieldSelect.click(1,50);
258
		DataPilotFieldSelect.openContextMenu();
259
		menuItem("Add to Row").select();
260
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
261
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
262
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
263
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
264
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
265
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
266
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
267
		sleep(1);
268
269
		CalcUtil.selectRange("B20");
270
		ActiveMsgBox.yes();
271
		sleep(1);
272
		assertEquals("Name",CalcUtil.getCellText("B1"));
273
		assertEquals("Date",CalcUtil.getCellText("A2"));
274
275
		DataPilotFieldSelect.drag(1, 1, 184, 80);
276
		assertEquals("Name",CalcUtil.getCellText("B1"));
277
		assertEquals("Date",CalcUtil.getCellText("A2"));
278
		sleep(1);
279
280
		DataPilotFieldSelect.click(1,70);
281
		DataPilotFieldSelect.openContextMenu();
282
		menuItem("Add to Data by->Sum").select();
283
		assertEquals("Name",CalcUtil.getCellText("B1"));
284
		assertEquals("Date",CalcUtil.getCellText("A2"));
285
		sleep(1);
286
287
		DataPilotTableUpdateButton.click();
288
		assertEquals("Locale",CalcUtil.getCellText("A1"));
289
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
290
		assertEquals("266773",CalcUtil.getCellText("J23"));
291
		sleep(1);
292
293
294
		typeKeys("<$undo>");
295
		assertEquals("Name",CalcUtil.getCellText("B1"));
296
		assertEquals("Date",CalcUtil.getCellText("A2"));
297
		sleep(1);
298
299
300
		typeKeys("<$redo>");
301
		assertEquals("Locale",CalcUtil.getCellText("A1"));
302
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
303
		assertEquals("266773",CalcUtil.getCellText("J23"));
304
		sleep(1);
305
306
		DataPilotAutomaticallyUpdateCheckBox.check();
307
		assertTrue(DataPilotAutomaticallyUpdateCheckBox.isChecked());
308
	}
309
310
	/**
311
	 * 
312
	 * Verify that DP panel will be synchronized with table while add fields on panel.
313
	 */
314
	@Ignore("DataPilot in symphony is totally not the same in AOO")
315
	public void testDataPilotChangeDataFieldOptionAutoUpdate() {
316
		//open the sample file Create DataPilotTable and verify the content
317
		String file = testFile("source_data01.ods");
318
		startcenter.menuItem("File->Open...").select();
319
		submitOpenDlg(file);
320
		sleep(2);
321
		CalcUtil.selectRange("A1:E27");
322
		calc.menuItem("Data->DataPilot->Start...").select();
323
		CreateDataPilotTableDialog.ok();
324
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
325
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
326
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
327
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
328
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
329
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
330
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
331
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
332
			DataPilotAutomaticallyUpdateCheckBox.check();
333
334
		}
335
		sleep(1);
336
337
		DataPilotFieldSelect.click(1, 1);
338
		DataPilotFieldSelect.openContextMenu();
339
		menuItem("Add to Column").select();
340
		assertEquals("Locale",CalcUtil.getCellText("A1"));
341
		sleep(1);
342
343
		DataPilotFieldSelect.click(1,30);
344
		DataPilotFieldSelect.openContextMenu();
345
		menuItem("Add to Column").select();
346
		assertEquals("Name",CalcUtil.getCellText("B1"));
347
		sleep(1);
348
349
		DataPilotFieldSelect.click(1,50);
350
		DataPilotFieldSelect.openContextMenu();
351
		menuItem("Add to Row").select();
352
		assertEquals("Date",CalcUtil.getCellText("A3"));
353
		sleep(1);
354
355
		DataPilotFieldSelect.click(1,70);
356
		DataPilotFieldSelect.openContextMenu();
357
		menuItem("Add to Row").select();
358
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
359
		sleep(1);
360
361
		DataPilotFieldSelect.click(1,90);
362
		DataPilotFieldSelect.openContextMenu();
363
		menuItem("Add to Data by->Sum").select();
364
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
365
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
366
		sleep(1);
367
368
		//Change Locale option settings, and verify it
369
		String target = "New Locale";
370
		DataPilotColumnArea.click(1,1);
371
		DataPilotColumnArea.openContextMenu();
372
		menuItem("Field Option").select();
373
		DataPilotFieldOptionFieldTabPageDialog.select();
374
		DataPilotFieldDisplayNameEditBox.setText(target);
375
		sleep(1);
376
377
		DataPilotFieldOptionFiledSubtotalsPage.select();
378
		sleep(1);
379
		DataPilotFieldOptionSubTotalsManuallyRadioButton.check();
380
		sleep(1);
381
		SC_DataPilotOptionSubtotalFunctionList.click(9,24);
382
		sleep(1);
383
384
		DataPilotFieldOptionSortTabPageDialog.select();
385
386
387
		DataPilotFieldOptionSortDescendingRadioButton.check();
388
		DataPilotFieldOptionFieldTabPageDialog.select();
389
		DataPilotFieldOptionFieldTabPageDialog.ok();
390
		sleep(1);
391
392
		assertEquals("New Locale",CalcUtil.getCellText("C1"));
393
		assertEquals("USA",CalcUtil.getCellText("C2"));
394
		assertEquals("USA Count - Amount",CalcUtil.getCellInput("H2"));
395
		assertEquals("17",CalcUtil.getCellInput("H30"));
396
		assertEquals("China Count - Amount",CalcUtil.getCellInput("L2"));
397
		assertEquals("9",CalcUtil.getCellInput("L30"));
398
		assertEquals("32779.17",CalcUtil.getCellInput("M30"));
399
400
		DataPilotColumnArea.click(1,30);
401
		DataPilotColumnArea.openContextMenu();
402
		menuItem("Field Option").select();
403
		DataPilotFieldOptionFieldTabPageDialog.select();
404
		DataPilotFieldShowItemWithoutDataCheckBox.check();
405
		DataPilotFieldOptionFieldTabPageDialog.ok();
406
		assertEquals("Emmy Ma",CalcUtil.getCellText("F3"));
407
		assertEquals("32779.17",CalcUtil.getCellInput("U30"));
408
409
		CalcUtil.selectRange("C1");
410
		SpreadSheetCells.openContextMenu();
411
		menuItem("Field Option...").select();
412
		DataPilotFieldOptionFieldTabPageDialog.select();
413
		DataPilotFieldDisplayNameEditBox.setText("Locale");
414
		DataPilotFieldOptionFiledSubtotalsPage.select();
415
		DataPilotFieldOptionSubTotalsNeverRadioButton.check();
416
		sleep(1);
417
		DataPilotFieldOptionSortTabPageDialog.select();
418
		DataPilotFieldOptionSortAscendingRadioButton.check();
419
		DataPilotFieldOptionFieldTabPageDialog.select();
420
		DataPilotFieldOptionFieldTabPageDialog.ok();
421
422
		assertEquals("Locale",CalcUtil.getCellText("C1"));
423
		assertEquals("China",CalcUtil.getCellText("C2"));
424
		assertEquals("USA",CalcUtil.getCellText("K2"));
425
		assertEquals("32779.17",CalcUtil.getCellInput("S30"));
426
427
428
		CalcUtil.selectRange("D1");
429
		SpreadSheetCells.openContextMenu();
430
		menuItem("Field Option...").select();
431
		DataPilotFieldOptionFieldTabPageDialog.select();
432
		DataPilotFieldShowItemWithoutDataCheckBox.uncheck();
433
		DataPilotFieldOptionFieldTabPageDialog.ok();
434
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
435
	}
436
437
	/**
438
	 * 
439
	 * Verify that Verify the Drag/Move function of Grouped field 
440
	 */
441
	@Ignore("DataPilot in symphony is totally not the same in AOO")
442
	public void testDragMoveFunctionOfGroupedField() {
443
		String file = testFile("source_data01.ods");
444
		startcenter.menuItem("File->Open...").select();
445
		submitOpenDlg(file);
446
		sleep(2);
447
		CalcUtil.selectRange("A1:E27");
448
		calc.menuItem("Data->DataPilot->Start...").select();
449
		CreateDataPilotTableDialog.ok();
450
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
451
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
452
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
453
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
454
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
455
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
456
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
457
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
458
			DataPilotAutomaticallyUpdateCheckBox.check();
459
460
		}
461
462
		DataPilotFieldSelect.click(1, 1);
463
		DataPilotFieldSelect.openContextMenu();
464
		menuItem("Add to Page").select();
465
		assertEquals("Locale",CalcUtil.getCellText("A1"));
466
		sleep(1);
467
468
		DataPilotFieldSelect.click(1,30);
469
		DataPilotFieldSelect.openContextMenu();
470
		menuItem("Add to Column").select();
471
		assertEquals("Name",CalcUtil.getCellText("A3"));
472
		sleep(1);
473
474
		DataPilotFieldSelect.click(1,50);
475
		DataPilotFieldSelect.openContextMenu();
476
		menuItem("Add to Row").select();
477
		assertEquals("Date",CalcUtil.getCellText("A4"));
478
		sleep(1);
479
480
		DataPilotFieldSelect.click(1,70);
481
		DataPilotFieldSelect.openContextMenu();
482
		menuItem("Add to Data by->Sum").select();
483
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
484
		assertEquals("266773",CalcUtil.getCellText("J23"));
485
		sleep(1);
486
487
		CalcUtil.selectRange("B4:C4");
488
		SpreadSheetCells.openContextMenu();
489
		menuItem("Group->Group Selected Items").select();
490
		assertEquals("Name2",CalcUtil.getCellText("B3"));
491
		assertEquals("Name",CalcUtil.getCellText("C3"));
492
		assertEquals("Group1",CalcUtil.getCellText("D4"));
493
		assertEquals("266773",CalcUtil.getCellText("J24"));
494
		sleep(1);
495
496
		DataPilotColumnArea.click(1,1);
497
		DataPilotColumnArea.openContextMenu();
498
		menuItem("Move to Row").select();
499
		assertEquals("Name2",CalcUtil.getCellText("B4"));
500
		assertEquals("Group1",CalcUtil.getCellText("B6"));
501
		assertEquals("266773",CalcUtil.getCellText("K31"));
502
		sleep(1);
503
504
		typeKeys("<$undo>");
505
		assertEquals("Name2",CalcUtil.getCellText("B3"));
506
		assertEquals("Name",CalcUtil.getCellText("C3"));
507
		assertEquals("Group1",CalcUtil.getCellText("D4"));
508
		assertEquals("266773",CalcUtil.getCellText("J24"));
509
		sleep(1);
510
511
		typeKeys("<$redo>");
512
		assertEquals("Name2",CalcUtil.getCellText("B4"));
513
		assertEquals("Group1",CalcUtil.getCellText("B6"));
514
		assertEquals("266773",CalcUtil.getCellText("K31"));
515
	}
516
517
	/**
518
	 * 
519
	 * Verify that DP panel while switch focus among tables with same/different source range.
520
	 */
521
	@Ignore("DataPilot in symphony is totally not the same in AOO")
522
	public void testHideShowPanel() {
523
		String file = testFile("source_data01.ods");
524
		startcenter.menuItem("File->Open...").select();
525
		submitOpenDlg(file);
526
		sleep(2);
527
		CalcUtil.selectRange("A1:E27");
528
		calc.menuItem("Data->DataPilot->Start...").select();		
529
		CreateDataPilotTableDialog.ok();
530
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
531
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
532
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
533
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
534
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
535
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
536
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
537
538
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
539
			DataPilotAutomaticallyUpdateCheckBox.check();
540
		}
541
542
		DataPilotFieldSelect.click(1, 1);
543
		DataPilotFieldSelect.openContextMenu();
544
		menuItem("Add to Page").select();
545
		assertEquals("Locale",CalcUtil.getCellText("A1"));
546
		sleep(1);
547
548
		DataPilotFieldSelect.click(1,30);
549
		DataPilotFieldSelect.openContextMenu();
550
		menuItem("Add to Column").select();
551
		assertEquals("Name",CalcUtil.getCellText("A3"));
552
		sleep(1);
553
554
		DataPilotFieldSelect.click(1,50);
555
		DataPilotFieldSelect.openContextMenu();
556
		menuItem("Add to Row").select();
557
		assertEquals("Date",CalcUtil.getCellText("A4"));
558
		sleep(1);
559
560
		DataPilotFieldSelect.click(1,70);
561
		DataPilotFieldSelect.openContextMenu();
562
		menuItem("Add to Data by->Sum").select();
563
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
564
		assertEquals("266773",CalcUtil.getCellText("J23"));
565
		sleep(1);
566
567
		CalcUtil.selectRange("A1:J24");
568
		typeKeys("<$copy>");
569
570
		CalcUtil.selectRange("A26");
571
		typeKeys("<$paste>");
572
		assertEquals("Locale",CalcUtil.getCellText("A26"));
573
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
574
		assertEquals("Name",CalcUtil.getCellText("B28"));
575
		assertEquals("Date",CalcUtil.getCellText("A29"));
576
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
577
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
578
		assertEquals("266773",CalcUtil.getCellText("J48"));
579
		sleep(1);
580
581
		CalcUtil.selectRange("A1");
582
		SpreadSheetCells.openContextMenu();
583
		menuItem("Show DataPilot Panel").select();
584
		assertFalse(DataPilotPanel.exists());
585
		sleep(1);
586
587
		CalcUtil.selectRange("A1");
588
		SpreadSheetCells.openContextMenu();
589
		menuItem("Show DataPilot Panel").select();
590
		assertTrue(DataPilotPanel.exists());
591
		sleep(1);
592
593
		DataPilotPanel.close();
594
		assertFalse(DataPilotPanel.exists());
595
		sleep(1);
596
597
		CalcUtil.selectRange("A26");
598
		DataPilotButton.click();
599
		sleep(1);
600
		assertTrue(DataPilotPanel.exists());
601
		assertEquals("Locale",CalcUtil.getCellText("A26"));
602
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
603
		assertEquals("Name",CalcUtil.getCellText("B28"));
604
		assertEquals("Date",CalcUtil.getCellText("A29"));
605
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
606
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
607
		assertEquals("266773",CalcUtil.getCellText("J48"));
608
	}
609
610
	/**
611
	 * 
612
	 * Verify that DP panel will be synchronized with table while add fields on panel.
613
	 */
614
	@Ignore("DataPilot in symphony is totally not the same in AOO")
615
	public void testMoveFieldInSameAreaManualUpdate() {
616
		String file = testFile("source_data01.ods");
617
		startcenter.menuItem("File->Open...").select();
618
		submitOpenDlg(file);
619
		sleep(2);
620
		CalcUtil.selectRange("A1:E27");
621
		calc.menuItem("Data->DataPilot->Start...").select();
622
		CreateDataPilotTableDialog.ok();
623
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
624
			DataPilotAutomaticallyUpdateCheckBox.check();
625
626
		}
627
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
628
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
629
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
630
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
631
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
632
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
633
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
634
		sleep(1);
635
636
		DataPilotFieldSelect.click(1, 1);
637
		DataPilotFieldSelect.openContextMenu();
638
		menuItem("Add to Column").select();
639
		assertEquals("Locale",CalcUtil.getCellText("A1"));
640
		sleep(1);
641
642
		DataPilotFieldSelect.click(1,30);
643
		DataPilotFieldSelect.openContextMenu();
644
		menuItem("Add to Column").select();
645
		assertEquals("Name",CalcUtil.getCellText("B1"));
646
		sleep(1);
647
648
		DataPilotFieldSelect.click(1,50);
649
		DataPilotFieldSelect.openContextMenu();
650
		menuItem("Add to Row").select();
651
		assertEquals("Date",CalcUtil.getCellText("A3"));
652
		sleep(1);
653
654
		DataPilotFieldSelect.click(1,70);
655
		DataPilotFieldSelect.openContextMenu();
656
		menuItem("Add to Row").select();
657
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
658
		sleep(1);
659
660
		DataPilotFieldSelect.click(1,90);
661
		DataPilotFieldSelect.openContextMenu();
662
		menuItem("Add to Data by->Sum").select();
663
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
664
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
665
		sleep(1);
666
667
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
668
		DataPilotColumnArea.drag(1, 1, 1, 60);
669
		assertEquals("Name",CalcUtil.getCellText("D1"));
670
		assertEquals("Locale",CalcUtil.getCellText("C1"));
671
		sleep(1);
672
673
		DataPilotPaneRowArea.drag(1,1, 1, 60);
674
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
675
		assertEquals("Date",CalcUtil.getCellText("A3"));
676
		sleep(1);
677
678
		CalcUtil.selectRange("A33");
679
		ActiveMsgBox.yes();
680
		assertEquals("Name",CalcUtil.getCellText("C1"));
681
		assertEquals("Locale",CalcUtil.getCellText("D1"));
682
		assertEquals("Order Number",CalcUtil.getCellText("A3"));
683
		assertEquals("Date",CalcUtil.getCellText("B3"));
684
		sleep(1);
685
686
		DataPilotColumnArea.click(1,1);
687
		DataPilotColumnArea.openContextMenu();
688
		menuItem("Move Down").select();
689
		assertEquals("Name",CalcUtil.getCellText("C1"));
690
		assertEquals("Locale",CalcUtil.getCellText("D1"));
691
		sleep(1);
692
693
		DataPilotPaneRowArea.click(1,30);
694
		DataPilotPaneRowArea.openContextMenu();
695
		menuItem("Move Up").select();
696
		assertEquals("Order Number",CalcUtil.getCellText("A3"));
697
		assertEquals("Date",CalcUtil.getCellText("B3"));
698
		sleep(1);
699
700
		CalcUtil.selectRange("A33");
701
		ActiveMsgBox.yes();
702
		assertEquals("Name",CalcUtil.getCellText("D1"));
703
		assertEquals("Locale",CalcUtil.getCellText("C1"));
704
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
705
		assertEquals("Date",CalcUtil.getCellText("A3"));
706
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
707
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
708
		DataPilotAutomaticallyUpdateCheckBox.check();
709
		sleep(1);
710
	}
711
712
	/**
713
	 * 
714
	 * Verify that DP panel will be synchronized with table while move fields on panel.
715
	 */
716
	@Ignore("DataPilot in symphony is totally not the same in AOO")
717
	public void testMoveFieldToOtherAreaAutoUpdate() {
718
		String file = testFile("source_data01.ods");
719
		startcenter.menuItem("File->Open...").select();
720
		submitOpenDlg(file);
721
		sleep(2);
722
		CalcUtil.selectRange("A1:E27");
723
		calc.menuItem("Data->DataPilot->Start...").select();
724
		CreateDataPilotTableDialog.ok();
725
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
726
			DataPilotAutomaticallyUpdateCheckBox.check();
727
728
		}
729
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
730
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
731
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
732
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
733
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
734
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
735
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
736
		sleep(1);
737
738
		DataPilotFieldSelect.click(1, 1);
739
		DataPilotFieldSelect.openContextMenu();
740
		menuItem("Add to Column").select();
741
		assertEquals("Locale",CalcUtil.getCellText("A1"));
742
		sleep(1);
743
744
		DataPilotFieldSelect.click(1,30);
745
		DataPilotFieldSelect.openContextMenu();
746
		menuItem("Add to Column").select();
747
		assertEquals("Name",CalcUtil.getCellText("B1"));
748
		sleep(1);
749
750
		DataPilotFieldSelect.click(1,50);
751
		DataPilotFieldSelect.openContextMenu();
752
		menuItem("Add to Row").select();
753
		assertEquals("Date",CalcUtil.getCellText("A3"));
754
		sleep(1);
755
756
		DataPilotFieldSelect.click(1,70);
757
		DataPilotFieldSelect.openContextMenu();
758
		menuItem("Add to Row").select();
759
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
760
		sleep(1);
761
762
		DataPilotFieldSelect.click(1,90);
763
		DataPilotFieldSelect.openContextMenu();
764
		menuItem("Add to Data by->Sum").select();
765
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
766
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
767
		sleep(1);
768
769
		DataPilotPaneRowArea.drag(1,1, 1, -50);
770
		assertEquals("Date",CalcUtil.getCellText("D1"));
771
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
772
		sleep(1);
773
774
		DataPilotColumnArea.click(1,50);
775
		DataPilotColumnArea.openContextMenu();
776
		menuItem("Move to Row").select();
777
		assertEquals("Date",CalcUtil.getCellText("B3"));
778
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
779
		sleep(1);
780
781
		typeKeys("<$undo>");
782
		assertEquals("Date",CalcUtil.getCellText("D1"));
783
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
784
		sleep(1);
785
786
		typeKeys("<$redo>");
787
		assertEquals("Date",CalcUtil.getCellText("B3"));
788
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
789
	}
790
791
	/**
792
	 * 
793
	 * Verify that DP panel will be synchronized with table while move fields on panel.
794
	 */
795
	@Ignore("DataPilot in symphony is totally not the same in AOO")
796
	public void testMoveFieldToOtherAreaDiscardChange() {
797
		String file = testFile("source_data01.ods");
798
		startcenter.menuItem("File->Open...").select();
799
		submitOpenDlg(file);
800
		sleep(2);
801
		CalcUtil.selectRange("A1:E27");
802
		calc.menuItem("Data->DataPilot->Start...").select();
803
		CreateDataPilotTableDialog.ok();
804
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
805
			DataPilotAutomaticallyUpdateCheckBox.check();
806
807
		}
808
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
809
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
810
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
811
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
812
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
813
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
814
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
815
		sleep(1);
816
817
		DataPilotFieldSelect.click(1, 1);
818
		DataPilotFieldSelect.openContextMenu();
819
		menuItem("Add to Column").select();
820
		assertEquals("Locale",CalcUtil.getCellText("A1"));
821
		sleep(1);
822
823
		DataPilotFieldSelect.click(1,30);
824
		DataPilotFieldSelect.openContextMenu();
825
		menuItem("Add to Column").select();
826
		assertEquals("Name",CalcUtil.getCellText("B1"));
827
		sleep(1);
828
829
		DataPilotFieldSelect.click(1,50);
830
		DataPilotFieldSelect.openContextMenu();
831
		menuItem("Add to Row").select();
832
		assertEquals("Date",CalcUtil.getCellText("A3"));
833
		sleep(1);
834
835
		DataPilotFieldSelect.click(1,70);
836
		DataPilotFieldSelect.openContextMenu();
837
		menuItem("Add to Row").select();
838
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
839
		sleep(1);
840
841
		DataPilotFieldSelect.click(1,90);
842
		DataPilotFieldSelect.openContextMenu();
843
		menuItem("Add to Data by->Sum").select();
844
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
845
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
846
		sleep(1);
847
848
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
849
850
		DataPilotPaneRowArea.drag(1,1, 1, -50);
851
		assertEquals("Date",CalcUtil.getCellText("A3"));
852
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
853
		sleep(1);
854
855
		CalcUtil.selectRange("B33");
856
		ActiveMsgBox.yes();
857
		assertEquals("Date",CalcUtil.getCellText("D1"));
858
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
859
		sleep(1);
860
861
		DataPilotColumnArea.click(1,50);
862
		DataPilotColumnArea.openContextMenu();
863
		menuItem("Move to Row").select();
864
		assertEquals("Date",CalcUtil.getCellText("D1"));
865
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
866
867
		CalcUtil.selectRange("B33");
868
		ActiveMsgBox.yes();
869
		assertEquals("Date",CalcUtil.getCellText("B3"));
870
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
871
		sleep(1);
872
873
		DataPilotAutomaticallyUpdateCheckBox.check();
874
	}
875
876
	/**
877
	 * 
878
	 * Verify that DP panel will be synchronized with table while move table.
879
	 * After the field name get changed, when you refresh the data, the DataPilot table will change to empty table
880
	 * if you create table small than the empty table, the table size will get larger
881
	 * if there is another DataPilot table exist in the larger range, there will pop a warning.
882
	 */
883
	@Ignore("DataPilot in symphony is totally not the same in AOO")
884
	public void testMoveTableNarrowSpaceToShowTheTable() {
885
		String file = testFile("source_data01.ods");
886
		startcenter.menuItem("File->Open...").select();
887
		submitOpenDlg(file);
888
		sleep(2);
889
		CalcUtil.selectRange("A1:E27");
890
		calc.menuItem("Data->DataPilot->Start...").select();
891
		CreateDataPilotTableDialog.ok();
892
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
893
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
894
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
895
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
896
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
897
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
898
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
899
900
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
901
			DataPilotAutomaticallyUpdateCheckBox.check();
902
		}
903
904
		DataPilotFieldSelect.click(1, 1);
905
		DataPilotFieldSelect.openContextMenu();
906
		menuItem("Add to Page").select();
907
		assertEquals("Locale",CalcUtil.getCellText("A1"));
908
		sleep(1);
909
910
		CalcUtil.selectRange("A1:B4");
911
		typeKeys("<$copy>");
912
		CalcUtil.selectRange("C1");
913
		typeKeys("<$paste>");
914
		sleep(1);
915
916
		CalcUtil.selectRange("$A.A1");
917
		typeKeys("New Locale" + "<enter>");
918
919
		CalcUtil.selectRange("$DataPilot_A_1.A1");
920
		SpreadSheetCells.openContextMenu();
921
		menuItem("Refresh Data").select();
922
		ActiveMsgBox.ok();
923
924
		CalcUtil.selectRange("A1:B4");
925
		SpreadSheetCells.drag(80, 45, 80, 350);
926
927
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B20"));
928
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B22"));
929
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B23"));
930
		assertEquals("Page Area",CalcUtil.getCellText("B25"));
931
		assertEquals("Row Area",CalcUtil.getCellText("B28"));
932
		assertEquals("Column Area",CalcUtil.getCellText("D27"));
933
		assertEquals("Data Area",CalcUtil.getCellText("D29"));
934
		DataPilotPanel.close();
935
		sleep(1);
936
937
		CalcUtil.selectRange("C1:D4");
938
		SpreadSheetCells.drag(210, 50, 10, 50);
939
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
940
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
941
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
942
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
943
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
944
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
945
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
946
	}
947
948
	/**
949
	 * 
950
	 * Verify the data pilot result table refresh after source data changed
951
	 */
952
	@Ignore("DataPilot in symphony is totally not the same in AOO")
953
	public void testOneMRowDataPilotRefresh() {
954
		String file = testFile("source_data01.ods");
955
		startcenter.menuItem("File->Open...").select();
956
		submitOpenDlg(file);
957
		sleep(2);
958
		calc.maximize();
959
		CalcUtil.selectRange("A1:E27");
960
		typeKeys("<$copy>");
961
		CalcUtil.selectRange("A1048540");
962
		typeKeys("<$paste>");
963
		calc.menuItem("Data->DataPilot->Start...").select();
964
		DataPilotTableToExistPlaceRadioButton.check();
965
		assertTrue(DataPilotTableToExistPlaceRadioButton.isChecked());
966
		DataPilotTableToExistPlaceEditBox.setText("$A.$F$1048540");
967
		CreateDataPilotTableDialog.ok();
968
		sleep(1);
969
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
970
			DataPilotAutomaticallyUpdateCheckBox.check();
971
972
		}
973
		DataPilotFieldSelect.click(1, 1);
974
		DataPilotFieldSelect.openContextMenu();
975
		menuItem("Add to Page").select();
976
		assertEquals("Locale",CalcUtil.getCellText("F1048540"));
977
		sleep(1);
978
979
		DataPilotFieldSelect.click(1,30);
980
		DataPilotFieldSelect.openContextMenu();
981
		menuItem("Add to Column").select();
982
		assertEquals("Name",CalcUtil.getCellText("F1048542"));
983
		sleep(1);
984
985
		DataPilotFieldSelect.click(1,50);
986
		DataPilotFieldSelect.openContextMenu();
987
		menuItem("Add to Row").select();
988
		assertEquals("Date",CalcUtil.getCellText("F1048543"));
989
		sleep(1);
990
991
		DataPilotFieldSelect.click(1,70);
992
		DataPilotFieldSelect.openContextMenu();
993
		menuItem("Add to Data by->Sum").select();
994
		assertEquals("Sum - Order Number",CalcUtil.getCellText("F1048542"));
995
		assertEquals("266773",CalcUtil.getCellText("O1048562"));
996
		sleep(1);
997
998
		CalcUtil.selectRange("D1048541");
999
		typeKeys("10000<enter>");
1000
		sleep(1);
1001
1002
		CalcUtil.selectRange("O1048562");
1003
		calc.menuItem("Data->DataPilot->Refresh").select();
1004
		assertEquals("266525",CalcUtil.getCellText("O1048562"));
1005
	}
1006
1007
	/**
1008
	 * 
1009
	 * Verify that DP panel will be synchronized with table while remove fields on panel.
1010
	 */
1011
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1012
	public void testRemoveFieldsDiscardChange() {
1013
		String file = testFile("source_data01.ods");
1014
		startcenter.menuItem("File->Open...").select();
1015
		submitOpenDlg(file);
1016
		sleep(2);
1017
		CalcUtil.selectRange("A1:E27");
1018
		calc.menuItem("Data->DataPilot->Start...").select();
1019
		CreateDataPilotTableDialog.ok();
1020
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1021
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1022
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1023
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1024
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1025
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1026
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1027
1028
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1029
			DataPilotAutomaticallyUpdateCheckBox.check();
1030
		}
1031
1032
		DataPilotFieldSelect.click(1, 1);
1033
		DataPilotFieldSelect.openContextMenu();
1034
		menuItem("Add to Page").select();
1035
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1036
		sleep(1);
1037
1038
		DataPilotFieldSelect.click(1,30);
1039
		DataPilotFieldSelect.openContextMenu();
1040
		menuItem("Add to Column").select();
1041
		assertEquals("Name",CalcUtil.getCellText("A3"));
1042
		sleep(1);
1043
1044
		DataPilotFieldSelect.click(1,50);
1045
		DataPilotFieldSelect.openContextMenu();
1046
		menuItem("Add to Row").select();
1047
		assertEquals("Date",CalcUtil.getCellText("A4"));
1048
		sleep(1);
1049
1050
		DataPilotFieldSelect.click(1,70);
1051
		DataPilotFieldSelect.openContextMenu();
1052
		menuItem("Add to Data by->Sum").select();
1053
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1054
		assertEquals("266773",CalcUtil.getCellText("J23"));
1055
		sleep(1);
1056
1057
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
1058
1059
		DataPilotColumnArea.drag(1, 1, -30, 1);
1060
		assertEquals("Name",CalcUtil.getCellText("B3"));
1061
		assertEquals("266773",CalcUtil.getCellText("J23"));
1062
		sleep(1);
1063
1064
		DataPilotPaneRowArea.click(1,1);
1065
		DataPilotPaneRowArea.openContextMenu();
1066
		menuItem("Remove").select();
1067
		assertEquals("Date",CalcUtil.getCellText("A4"));
1068
		assertEquals("266773",CalcUtil.getCellText("J23"));
1069
		sleep(1);
1070
1071
		DataPilotPanePageArea.drag(1, 1, -30, 1);
1072
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1073
		assertEquals("266773",CalcUtil.getCellText("J23"));
1074
		sleep(1);
1075
1076
		DataPiloPaneDataArea.openContextMenu();
1077
		menuItem("Remove").select();
1078
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1079
		assertEquals("266773",CalcUtil.getCellText("J23"));
1080
1081
		CalcUtil.selectRange("B25");
1082
		ActiveMsgBox.yes();
1083
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1084
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1085
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1086
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1087
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1088
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1089
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1090
1091
		DataPilotAutomaticallyUpdateCheckBox.check();
1092
	}
1093
1094
	/**
1095
	 * 
1096
	 * Verify the Remove function of Grouped field 
1097
	 */
1098
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1099
	public void testRemoveFunctionOfGroupedField() {
1100
		String file = testFile("source_data01.ods");
1101
		startcenter.menuItem("File->Open...").select();
1102
		submitOpenDlg(file);
1103
		sleep(2);
1104
		CalcUtil.selectRange("A1:E27");
1105
		calc.menuItem("Data->DataPilot->Start...").select();		
1106
		CreateDataPilotTableDialog.ok();
1107
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1108
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1109
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1110
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1111
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1112
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1113
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1114
1115
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1116
			DataPilotAutomaticallyUpdateCheckBox.check();
1117
		}
1118
1119
		DataPilotFieldSelect.click(1, 1);
1120
		DataPilotFieldSelect.openContextMenu();
1121
		menuItem("Add to Page").select();
1122
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1123
		sleep(1);
1124
1125
		DataPilotFieldSelect.click(1,30);
1126
		DataPilotFieldSelect.openContextMenu();
1127
		menuItem("Add to Column").select();
1128
		assertEquals("Name",CalcUtil.getCellText("A3"));
1129
		sleep(1);
1130
1131
		DataPilotFieldSelect.click(1,50);
1132
		DataPilotFieldSelect.openContextMenu();
1133
		menuItem("Add to Row").select();
1134
		assertEquals("Date",CalcUtil.getCellText("A4"));
1135
		sleep(1);
1136
1137
		DataPilotFieldSelect.click(1,70);
1138
		DataPilotFieldSelect.openContextMenu();
1139
		menuItem("Add to Data by->Sum").select();
1140
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1141
		assertEquals("266773",CalcUtil.getCellText("J23"));
1142
		sleep(1);
1143
1144
		CalcUtil.selectRange("B4:C4");
1145
		SpreadSheetCells.openContextMenu();
1146
		menuItem("Group->Group Selected Items").select();
1147
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1148
		assertEquals("Name",CalcUtil.getCellText("C3"));
1149
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1150
		assertEquals("266773",CalcUtil.getCellText("J24"));
1151
		sleep(1);
1152
1153
		CalcUtil.selectRange("D4");
1154
		SpreadSheetCells.openContextMenu();
1155
		menuItem("Group->Ungroup").select();
1156
		assertEquals("Name",CalcUtil.getCellText("B3"));
1157
		assertEquals("",CalcUtil.getCellText("C3"));
1158
		assertEquals("Bill Zhang",CalcUtil.getCellText("D4"));
1159
		assertEquals("266773",CalcUtil.getCellText("J23"));
1160
	}
1161
1162
	/**
1163
	 * 
1164
	 * Verify that DP panel will be synchronized with table while rename fields on panel.
1165
	 */
1166
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1167
	public void testRenameFieldAutoUpdate() {
1168
		String file = testFile("source_data01.ods");
1169
		startcenter.menuItem("File->Open...").select();
1170
		submitOpenDlg(file);
1171
		sleep(2);
1172
		CalcUtil.selectRange("A1:E27");
1173
		calc.menuItem("Data->DataPilot->Start...").select();
1174
		CreateDataPilotTableDialog.ok();
1175
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1176
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1177
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1178
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1179
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1180
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1181
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1182
1183
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1184
			DataPilotAutomaticallyUpdateCheckBox.check();
1185
		}
1186
1187
		DataPilotFieldSelect.click(1, 1);
1188
		DataPilotFieldSelect.openContextMenu();
1189
		menuItem("Add to Page").select();
1190
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1191
		sleep(1);
1192
1193
		DataPilotFieldSelect.click(1,30);
1194
		DataPilotFieldSelect.openContextMenu();
1195
		menuItem("Add to Column").select();
1196
		assertEquals("Name",CalcUtil.getCellText("A3"));
1197
		sleep(1);
1198
1199
		DataPilotFieldSelect.click(1,50);
1200
		DataPilotFieldSelect.openContextMenu();
1201
		menuItem("Add to Row").select();
1202
		assertEquals("Date",CalcUtil.getCellText("A4"));
1203
		sleep(1);
1204
1205
		DataPilotFieldSelect.click(1,70);
1206
		DataPilotFieldSelect.openContextMenu();
1207
		menuItem("Add to Data by->Sum").select();
1208
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1209
		assertEquals("266773",CalcUtil.getCellText("J23"));
1210
		sleep(1);
1211
1212
		DataPilotPanePageArea.click(1,1);
1213
		DataPilotPanePageArea.openContextMenu();
1214
		menuItem("Field Option").select();
1215
		DataPilotFieldDisplayNameEditBox.setText("New Locale");
1216
		DataPilotFieldOptionFieldTabPageDialog.ok();
1217
		assertEquals("New Locale",CalcUtil.getCellText("A1"));
1218
		sleep(1);
1219
1220
		typeKeys("<$undo>");
1221
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1222
		sleep(1);
1223
1224
		typeKeys("<$redo>");
1225
		assertEquals("New Locale",CalcUtil.getCellText("A1"));
1226
		sleep(1);
1227
1228
		CalcUtil.selectRange("B3");
1229
		SpreadSheetCells.openContextMenu();
1230
		menuItem("Field Option...").select();
1231
		DataPilotFieldDisplayNameEditBox.setText("New Name");
1232
		DataPilotFieldOptionFieldTabPageDialog.ok();
1233
		assertEquals("New Name",CalcUtil.getCellText("B3"));
1234
		sleep(1);
1235
1236
		typeKeys("<$undo>");
1237
		assertEquals("Name",CalcUtil.getCellText("B3"));
1238
		sleep(1);
1239
1240
		typeKeys("<$redo>");
1241
		assertEquals("New Name",CalcUtil.getCellText("B3"));
1242
		sleep(1);
1243
1244
		CalcUtil.selectRange("A4");
1245
		SpreadSheetCells.openContextMenu();
1246
		menuItem("Field Option...").select();
1247
		DataPilotFieldDisplayNameEditBox.setText("New Date");
1248
		DataPilotFieldOptionFieldTabPageDialog.ok();
1249
		assertEquals("New Date",CalcUtil.getCellText("A4"));
1250
		sleep(1);
1251
1252
		typeKeys("<$undo>");
1253
		assertEquals("Date",CalcUtil.getCellText("A4"));
1254
		sleep(1);
1255
1256
		typeKeys("<$redo>");
1257
		assertEquals("New Date",CalcUtil.getCellText("A4"));
1258
		sleep(1);
1259
1260
		DataPiloPaneDataArea.openContextMenu();
1261
		menuItem("Field Option").select();
1262
		DataPilotFieldDisplayNameEditBox.setText("New Sum - Order Number");
1263
		DataPilotFieldOptionFieldTabPageDialog.ok();
1264
		assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3"));
1265
		sleep(1);
1266
1267
		typeKeys("<$undo>");
1268
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1269
		sleep(1);
1270
1271
		typeKeys("<$redo>");
1272
		assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3"));
1273
		sleep(1);
1274
	}
1275
1276
	/**
1277
	 * 
1278
	 * Verify that DP panel will be synchronized with table while add fields on panel.
1279
	 */
1280
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1281
	public void testSortFunctionInGroupedField() {
1282
		String file = testFile("source_data01.ods");
1283
		startcenter.menuItem("File->Open...").select();
1284
		submitOpenDlg(file);
1285
		sleep(2);
1286
		CalcUtil.selectRange("A1:E27");
1287
		calc.menuItem("Data->DataPilot->Start...").select();		
1288
		CreateDataPilotTableDialog.ok();
1289
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1290
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1291
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1292
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1293
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1294
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1295
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1296
1297
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1298
			DataPilotAutomaticallyUpdateCheckBox.check();
1299
		}
1300
1301
		DataPilotFieldSelect.click(1, 1);
1302
		DataPilotFieldSelect.openContextMenu();
1303
		menuItem("Add to Page").select();
1304
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1305
		sleep(1);
1306
1307
		DataPilotFieldSelect.click(1,30);
1308
		DataPilotFieldSelect.openContextMenu();
1309
		menuItem("Add to Column").select();
1310
		assertEquals("Name",CalcUtil.getCellText("A3"));
1311
		sleep(1);
1312
1313
		DataPilotFieldSelect.click(1,50);
1314
		DataPilotFieldSelect.openContextMenu();
1315
		menuItem("Add to Row").select();
1316
		assertEquals("Date",CalcUtil.getCellText("A4"));
1317
		sleep(1);
1318
1319
		DataPilotFieldSelect.click(1,70);
1320
		DataPilotFieldSelect.openContextMenu();
1321
		menuItem("Add to Data by->Sum").select();
1322
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1323
		assertEquals("266773",CalcUtil.getCellText("J23"));
1324
		sleep(1);
1325
1326
		CalcUtil.selectRange("B4:C4");
1327
		SpreadSheetCells.openContextMenu();
1328
		menuItem("Group->Group Selected Items").select();
1329
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1330
		assertEquals("Name",CalcUtil.getCellInput("C3"));
1331
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1332
		assertEquals("266773",CalcUtil.getCellText("J24"));
1333
		sleep(1);
1334
1335
		CalcUtil.selectRange("B3");
1336
		SpreadSheetCells.openContextMenu();
1337
		menuItem("Field Option...").select();
1338
		DataPilotFieldOptionSortTabPageDialog.select();
1339
1340
		DataPilotFieldOptionSortDescendingRadioButton.check();
1341
		DataPilotFieldOptionFieldTabPageDialog.select();
1342
		DataPilotFieldOptionFieldTabPageDialog.ok();
1343
		sleep(1);
1344
1345
		assertEquals("Kevin Wang",CalcUtil.getCellText("B4"));
1346
		assertEquals("Group1",CalcUtil.getCellText("F4"));
1347
		assertEquals("Bill Zhang",CalcUtil.getCellText("I4"));
1348
		assertEquals("266773",CalcUtil.getCellText("J24"));
1349
1350
		typeKeys("<$undo>");
1351
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
1352
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1353
		assertEquals("Kevin Wang",CalcUtil.getCellText("I4"));
1354
		assertEquals("266773",CalcUtil.getCellText("J24"));
1355
		sleep(1);
1356
1357
		typeKeys("<$redo>");
1358
		assertEquals("Kevin Wang",CalcUtil.getCellText("B4"));
1359
		assertEquals("Group1",CalcUtil.getCellText("F4"));
1360
		assertEquals("Bill Zhang",CalcUtil.getCellText("I4"));
1361
		assertEquals("266773",CalcUtil.getCellText("J24"));
1362
	}
1363
1364
	/**
1365
	 * 
1366
	 * Verify that DP panel will be synchronized with table while add fields on panel.
1367
	 */
1368
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1369
	public void testSubtotalsFunctionInGroupedField() {
1370
		String file = testFile("source_data01.ods");
1371
		startcenter.menuItem("File->Open...").select();
1372
		submitOpenDlg(file);
1373
		sleep(2);
1374
		CalcUtil.selectRange("A1:E27");
1375
		calc.menuItem("Data->DataPilot->Start...").select();		
1376
		CreateDataPilotTableDialog.ok();
1377
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1378
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1379
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1380
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1381
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1382
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1383
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1384
1385
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1386
			DataPilotAutomaticallyUpdateCheckBox.check();
1387
		}
1388
1389
		DataPilotFieldSelect.click(1, 1);
1390
		DataPilotFieldSelect.openContextMenu();
1391
		menuItem("Add to Page").select();
1392
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1393
		sleep(1);
1394
1395
		DataPilotFieldSelect.click(1,30);
1396
		DataPilotFieldSelect.openContextMenu();
1397
		menuItem("Add to Column").select();
1398
		assertEquals("Name",CalcUtil.getCellText("A3"));
1399
		sleep(1);
1400
1401
		DataPilotFieldSelect.click(1,50);
1402
		DataPilotFieldSelect.openContextMenu();
1403
		menuItem("Add to Row").select();
1404
		assertEquals("Date",CalcUtil.getCellText("A4"));
1405
		sleep(1);
1406
1407
		DataPilotFieldSelect.click(1,70);
1408
		DataPilotFieldSelect.openContextMenu();
1409
		menuItem("Add to Data by->Sum").select();
1410
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1411
		assertEquals("266773",CalcUtil.getCellText("J23"));
1412
		sleep(1);
1413
1414
		CalcUtil.selectRange("B4:C4");
1415
		SpreadSheetCells.openContextMenu();
1416
		menuItem("Group->Group Selected Items").select();
1417
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1418
		assertEquals("Name",CalcUtil.getCellText("C3"));
1419
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1420
		assertEquals("266773",CalcUtil.getCellText("J24"));
1421
		sleep(1);
1422
1423
		CalcUtil.selectRange("B3");
1424
		SpreadSheetCells.openContextMenu();
1425
		menuItem("Field Option...").select();
1426
		DataPilotFieldOptionFiledSubtotalsPage.select();
1427
		sleep(1);
1428
1429
		DataPilotFieldOptionSubTotalsManuallyRadioButton.check();
1430
1431
		SC_DataPilotOptionSubtotalFunctionList.click(9,24);
1432
		sleep(1);
1433
		DataPilotFieldOptionFieldTabPageDialog.select();
1434
		DataPilotFieldOptionFieldTabPageDialog.ok();
1435
1436
		assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4"));
1437
		assertEquals("5",CalcUtil.getCellText("C24"));
1438
1439
		assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4"));
1440
		assertEquals("2",CalcUtil.getCellText("E24"));
1441
1442
		assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4"));
1443
		assertEquals("9",CalcUtil.getCellText("H24"));
1444
1445
		assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4"));
1446
		assertEquals("1",CalcUtil.getCellText("J24"));
1447
1448
		assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4"));
1449
		assertEquals("2",CalcUtil.getCellText("L24"));
1450
1451
		assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4"));
1452
		assertEquals("4",CalcUtil.getCellText("N24"));
1453
1454
		assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4"));
1455
		assertEquals("3",CalcUtil.getCellText("P24"));
1456
		assertEquals("266773",CalcUtil.getCellText("Q24"));
1457
		sleep(1);
1458
1459
		typeKeys("<$undo>");
1460
		assertEquals("Emmy Ma",CalcUtil.getCellText("C4"));
1461
		assertEquals("20518",CalcUtil.getCellText("C24"));
1462
1463
		assertEquals("",CalcUtil.getCellText("E4"));
1464
		assertEquals("20528",CalcUtil.getCellText("E24"));
1465
1466
		assertEquals("Joe Liu",CalcUtil.getCellText("H4"));
1467
		assertEquals("41056",CalcUtil.getCellText("H24"));
1468
1469
		assertEquals("Total Result",CalcUtil.getCellText("J4"));
1470
		assertEquals("266773",CalcUtil.getCellText("J24"));
1471
1472
		assertEquals("",CalcUtil.getCellText("L4"));
1473
		assertEquals("",CalcUtil.getCellText("L24"));
1474
1475
		assertEquals("",CalcUtil.getCellText("N4"));
1476
		assertEquals("",CalcUtil.getCellText("N24"));
1477
1478
		assertEquals("",CalcUtil.getCellText("P4"));
1479
		assertEquals("",CalcUtil.getCellText("P24"));
1480
		assertEquals("",CalcUtil.getCellText("Q24"));
1481
		sleep(1);
1482
1483
		typeKeys("<$redo>");
1484
		assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4"));
1485
		assertEquals("5",CalcUtil.getCellText("C24"));
1486
1487
		assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4"));
1488
		assertEquals("2",CalcUtil.getCellText("E24"));
1489
1490
		assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4"));
1491
		assertEquals("9",CalcUtil.getCellText("H24"));
1492
1493
		assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4"));
1494
		assertEquals("1",CalcUtil.getCellText("J24"));
1495
1496
		assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4"));
1497
		assertEquals("2",CalcUtil.getCellText("L24"));
1498
1499
		assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4"));
1500
		assertEquals("4",CalcUtil.getCellText("N24"));
1501
1502
		assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4"));
1503
		assertEquals("3",CalcUtil.getCellText("P24"));
1504
		assertEquals("266773",CalcUtil.getCellText("Q24"));
1505
	}
1506
1507
	/**
1508
	 * 
1509
	 * Verify that DP panel will be synchronized with table while add fields on panel.
1510
	 */
1511
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1512
	public void testTopNFunctionInGroupedField() {
1513
		String file = testFile("source_data01.ods");
1514
		startcenter.menuItem("File->Open...").select();
1515
		submitOpenDlg(file);
1516
		sleep(2);
1517
		CalcUtil.selectRange("A1:E27");
1518
		calc.menuItem("Data->DataPilot->Start...").select();		
1519
		CreateDataPilotTableDialog.ok();
1520
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1521
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1522
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1523
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1524
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1525
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1526
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1527
1528
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1529
			DataPilotAutomaticallyUpdateCheckBox.check();
1530
		}
1531
1532
		DataPilotFieldSelect.click(1, 1);
1533
		DataPilotFieldSelect.openContextMenu();
1534
		menuItem("Add to Page").select();
1535
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1536
		sleep(1);
1537
1538
		DataPilotFieldSelect.click(1,30);
1539
		DataPilotFieldSelect.openContextMenu();
1540
		menuItem("Add to Column").select();
1541
		assertEquals("Name",CalcUtil.getCellText("A3"));
1542
		sleep(1);
1543
1544
		DataPilotFieldSelect.click(1,50);
1545
		DataPilotFieldSelect.openContextMenu();
1546
		menuItem("Add to Row").select();
1547
		assertEquals("Date",CalcUtil.getCellText("A4"));
1548
		sleep(1);
1549
1550
		DataPilotFieldSelect.click(1,70);
1551
		DataPilotFieldSelect.openContextMenu();
1552
		menuItem("Add to Data by->Sum").select();
1553
		assertEquals("Sum - Order Number",CalcUtil.getCellInput("A3"));
1554
		assertEquals("266773",CalcUtil.getCellText("J23"));
1555
		sleep(1);
1556
1557
		CalcUtil.selectRange("B4:C4");
1558
		SpreadSheetCells.openContextMenu();
1559
		menuItem("Group->Group Selected Items").select();
1560
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1561
		assertEquals("Name",CalcUtil.getCellText("C3"));
1562
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1563
		assertEquals("266773",CalcUtil.getCellText("J24"));
1564
		sleep(1);
1565
1566
		CalcUtil.selectRange("A1");
1567
		sleep(1);
1568
1569
		// the Display resolution is 1280 * 1050 on windows and Linux and 1920 * 1080 on Mac
1570
		if(SystemUtil.isWindows()){
1571
			SpreadSheetCells.click(238, 43);
1572
		}
1573
		else if(SystemUtil.isLinux()){
1574
			SpreadSheetCells.click(267, 43);
1575
		}
1576
		else if(SystemUtil.isMac()){
1577
			SpreadSheetCells.click(238, 43);
1578
		}
1579
1580
		typeKeys("<tab>");
1581
		typeKeys("<tab>");
1582
		typeKeys("<tab>");
1583
		typeKeys("<tab>");
1584
		typeKeys("<tab>");
1585
		typeKeys("<tab>");
1586
		typeKeys("<enter>");
1587
		OnlyDisplayTopNItemCheckBox.check();
1588
		NumberOfItemShowInTopNEditBox.setText("4");
1589
		FieldTopNSettingDialog.ok();
1590
		sleep(1);
1591
1592
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
1593
		assertEquals("51299",CalcUtil.getCellText("B24"));
1594
1595
		assertEquals("Group1",CalcUtil.getCellText("C4"));
1596
		assertEquals("71806",CalcUtil.getCellText("C24"));
1597
		assertEquals("",CalcUtil.getCellText("D4"));
1598
		assertEquals("Amy Zhao",CalcUtil.getCellText("C5"));
1599
		assertEquals("Anne Lee",CalcUtil.getCellText("D5"));
1600
		assertEquals("20528",CalcUtil.getCellText("D24"));
1601
1602
		assertEquals("Joe Liu",CalcUtil.getCellText("E4"));
1603
		assertEquals("41056",CalcUtil.getCellText("E24"));
1604
1605
		assertEquals("Kevin Wang",CalcUtil.getCellText("F4"));
1606
		assertEquals("30771",CalcUtil.getCellText("F24"));
1607
1608
		assertEquals("Total Result",CalcUtil.getCellText("G4"));
1609
		assertEquals("215460",CalcUtil.getCellText("G24"));
1610
		sleep(1);
1611
1612
		typeKeys("<$undo>");
1613
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1614
		assertEquals("Name",CalcUtil.getCellText("C3"));
1615
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1616
		assertEquals("266773",CalcUtil.getCellText("J24"));
1617
1618
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
1619
		assertEquals("51299",CalcUtil.getCellText("B24"));
1620
1621
		assertEquals("Emmy Ma",CalcUtil.getCellText("C4"));
1622
		assertEquals("20518",CalcUtil.getCellText("C24"));
1623
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1624
		assertEquals("Emmy Ma",CalcUtil.getCellText("C5"));
1625
		assertEquals("Amy Zhao",CalcUtil.getCellText("D5"));
1626
		assertEquals("71806",CalcUtil.getCellText("D24"));
1627
1628
		assertEquals("",CalcUtil.getCellText("E4"));
1629
		assertEquals("20528",CalcUtil.getCellText("E24"));
1630
1631
		assertEquals("Harry Wu",CalcUtil.getCellText("F4"));
1632
		assertEquals("10265",CalcUtil.getCellText("F24"));
1633
1634
		assertEquals("Jerry Lu",CalcUtil.getCellText("G4"));
1635
		assertEquals("20530",CalcUtil.getCellText("G24"));
1636
1637
		assertEquals("Total Result",CalcUtil.getCellText("J4"));
1638
		assertEquals("266773",CalcUtil.getCellText("J24"));
1639
		sleep(1);
1640
1641
		typeKeys("<$redo>");
1642
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
1643
		assertEquals("51299",CalcUtil.getCellText("B24"));
1644
1645
		assertEquals("Group1",CalcUtil.getCellText("C4"));
1646
		assertEquals("71806",CalcUtil.getCellText("C24"));
1647
		assertEquals("",CalcUtil.getCellText("D4"));
1648
		assertEquals("Amy Zhao",CalcUtil.getCellText("C5"));
1649
		assertEquals("Anne Lee",CalcUtil.getCellText("D5"));
1650
		assertEquals("20528",CalcUtil.getCellText("D24"));
1651
1652
		assertEquals("Joe Liu",CalcUtil.getCellText("E4"));
1653
		assertEquals("41056",CalcUtil.getCellText("E24"));
1654
1655
		assertEquals("Kevin Wang",CalcUtil.getCellText("F4"));
1656
		assertEquals("30771",CalcUtil.getCellText("F24"));
1657
1658
		assertEquals("Total Result",CalcUtil.getCellText("G4"));
1659
		assertEquals("215460",CalcUtil.getCellText("G24"));
1660
	}	
153
}
1661
}
(-)src/testcase/sd/headerandfooter/HeaderAndFooterSetting.java (-1 / +1 lines)
Lines 24-30 Link Here
24
/**
24
/**
25
 * 
25
 * 
26
 */
26
 */
27
package testcase.presentation.headerandfooter;
27
package testcase.sd.headerandfooter;
28
28
29
import static testlib.AppUtil.fullPath;
29
import static testlib.AppUtil.fullPath;
30
import static testlib.AppUtil.openStartcenter;
30
import static testlib.AppUtil.openStartcenter;
(-)src/testcase/sc/datapilot/DataPilotAddFieldsManualUpdate.java (-166 lines)
Lines 1-166 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 DataPilotAddFieldsManualUpdate {
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
		
97
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
98
		
99
		sleep(1);
100
		DataPilotFieldSelect.click(1, 30);
101
		DataPilotFieldSelect.openContextMenu();
102
		menuItem("Add to Column").select();
103
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
104
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
105
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
106
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
107
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
108
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
109
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
110
		sleep(1);
111
		
112
		DataPilotFieldSelect.click(1,50);
113
		DataPilotFieldSelect.openContextMenu();
114
		menuItem("Add to Row").select();
115
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
116
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
117
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
118
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
119
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
120
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
121
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
122
		sleep(1);
123
		
124
		CalcUtil.selectRange("B20");
125
		ActiveMsgBox.yes();
126
		sleep(1);
127
		assertEquals("Name",CalcUtil.getCellText("B1"));
128
		assertEquals("Date",CalcUtil.getCellText("A2"));
129
		
130
		DataPilotFieldSelect.drag(1, 1, 184, 80);
131
		assertEquals("Name",CalcUtil.getCellText("B1"));
132
		assertEquals("Date",CalcUtil.getCellText("A2"));
133
		sleep(1);
134
		
135
		DataPilotFieldSelect.click(1,70);
136
		DataPilotFieldSelect.openContextMenu();
137
		menuItem("Add to Data by->Sum").select();
138
		assertEquals("Name",CalcUtil.getCellText("B1"));
139
		assertEquals("Date",CalcUtil.getCellText("A2"));
140
		sleep(1);
141
		
142
		DataPilotTableUpdateButton.click();
143
		assertEquals("Locale",CalcUtil.getCellText("A1"));
144
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
145
		assertEquals("266773",CalcUtil.getCellText("J23"));
146
		sleep(1);
147
		
148
		
149
		typeKeys("<$undo>");
150
		assertEquals("Name",CalcUtil.getCellText("B1"));
151
		assertEquals("Date",CalcUtil.getCellText("A2"));
152
		sleep(1);
153
		
154
		
155
		typeKeys("<$redo>");
156
		assertEquals("Locale",CalcUtil.getCellText("A1"));
157
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
158
		assertEquals("266773",CalcUtil.getCellText("J23"));
159
		sleep(1);
160
		
161
		DataPilotAutomaticallyUpdateCheckBox.check();
162
		assertTrue(DataPilotAutomaticallyUpdateCheckBox.isChecked());
163
	}
164
165
}
166
(-)src/testcase/sc/chart/ChartDialogSetting.java (-38 / +24 lines)
Lines 26-97 Link Here
26
 */
26
 */
27
package testcase.sc.chart;
27
package testcase.sc.chart;
28
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
29
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
30
import org.junit.After;
36
import static org.junit.Assert.*;
31
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
32
import org.junit.Before;
40
import org.junit.Ignore;
41
import org.junit.Rule;
33
import org.junit.Rule;
42
import org.junit.Test;
34
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;
35
import testlib.Log;
48
36
49
/**
37
/**
50
 * 
38
 * Test the setting about chart dialog in spreadsheet
51
 *
52
 */
39
 */
53
public class ChartDialogCancelBack {
40
public class ChartDialogSetting {
54
	/**
41
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
42
	@Rule
60
	public Log LOG = new Log();
43
	public Log LOG = new Log();
61
	
44
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
45
	@Before
71
	public void setUp() throws Exception {
46
	public void setUp() throws Exception {
72
		initApp();
47
		app.start();
48
49
		// Create a new spreadsheet document
50
		startcenter.menuItem("File->New->Spreadsheet").select();
73
	}
51
	}
52
53
	@After
54
	public void tearDown() throws Exception {
55
		app.close();
56
	}
57
74
	/**
58
	/**
75
	 * Test cancel and back button in chart wizard dialog
59
	 * Test cancel and back button in chart wizard dialog
76
	 * 
60
	 * 
77
	 * @throws java.lang.Exception
61
	 * @throws java.lang.Exception
78
	 */
62
	 */
79
	@Test
63
	@Test
80
	public void test() {
64
	public void testChartDialogCancelBack() {
81
		//Create a new text document
82
		startcenter.menuItem("File->New->Spreadsheet").select();
83
		sleep(3);
84
		calc.menuItem("Insert->Chart...").select();
65
		calc.menuItem("Insert->Chart...").select();
85
		sleep(1);
86
		WizardNextButton.click();
66
		WizardNextButton.click();
87
		sleep(1);
88
		assertTrue(ChartRangeChooseTabPage.isEnabled());
67
		assertTrue(ChartRangeChooseTabPage.isEnabled());
89
		WizardBackButton.click();
68
		WizardBackButton.click();
90
		sleep(1);
91
		assertTrue(ChartTypeChooseTabPage.isEnabled());
69
		assertTrue(ChartTypeChooseTabPage.isEnabled());
92
		Chart_Wizard.cancel();
70
		Chart_Wizard.cancel();
93
		sleep(1);
94
		assertFalse(Chart_Wizard.exists());
71
		assertFalse(Chart_Wizard.exists());
95
	}
72
	}
96
73
74
	/**
75
	 * Verify Chart Wizard dialog title words
76
	 */
77
	@Test
78
	public void testChartWizardTitle() {
79
		calc.menuItem("Insert->Chart...").select();
80
		assertEquals("Chart Wizard",Chart_Wizard.getText());
81
		Chart_Wizard.cancel();
82
	}
97
}
83
}
(-)src/testcase/sc/validity/AllowBlankCells.java (-130 lines)
Lines 1-130 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 AllowBlankCells {
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 Blank cell Checkbox in Validity.
73
	 */
74
	@Test
75
	public void testAllowBlankCells() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
79
		String a ="A";
80
		for(int j=1;j<=6;j++){
81
			CalcUtil.selectRange("Sheet1.A"+j);
82
			typeKeys(a);
83
			typeKeys("<enter>");
84
		}
85
		CalcUtil.selectRange("Sheet1.A1:A6");
86
		typeKeys("<$copy>");
87
		CalcUtil.selectRange("Sheet1.B1");
88
		typeKeys("<$paste>");
89
		CalcUtil.selectRange("Sheet1.C1");
90
		typeKeys("<$paste>");
91
92
		CalcUtil.selectRange("Sheet1.D1");
93
		calc.menuItem("Data->Validity...").select();
94
		sleep(1);
95
		SC_ValidityCriteriaTabpage.select();
96
		SC_ValidityCriteriaAllowList.select("Cell range");
97
		SC_ValiditySourceInput.setText("$A$1:$C$6");
98
		SC_ValidityAllowBlankCells.check();
99
		typeKeys("<enter>");	
100
		
101
				
102
		CalcUtil.selectRange("Sheet1.D1");
103
		sleep(1);
104
		typeKeys(a);
105
		typeKeys("<enter>");
106
		CalcUtil.selectRange("Sheet1.D1");
107
		SC_CellInput.activate();
108
		typeKeys("<backspace>");
109
		sleep(1);
110
		typeKeys("<enter>");
111
		assertEquals("",CalcUtil.getCellText("Sheet1.D1"));
112
		
113
		typeKeys(a);
114
		calc.menuItem("Data->Validity...").select();
115
		sleep(1);
116
		SC_ValidityCriteriaTabpage.select();
117
		SC_ValidityAllowBlankCells.uncheck();
118
		
119
		typeKeys("<enter>");
120
		
121
		CalcUtil.selectRange("Sheet1.D1");
122
		SC_CellInput.activate();
123
		typeKeys("<backspace>");
124
		typeKeys("<enter>");
125
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
126
	
127
	}
128
129
}
130
(-)src/testcase/sc/filter/Fitler.java (-30 / +15 lines)
Lines 28-87 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 java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
31
import org.junit.After;
36
import static org.junit.Assert.*;
32
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
33
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
34
import org.junit.Before;
40
import org.junit.Ignore;
35
import org.junit.Ignore;
41
import org.junit.Rule;
36
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;
37
import testlib.CalcUtil;
47
import testlib.Log;
38
import testlib.Log;
48
39
49
/**
40
/**
50
 * 
41
 * Test cases about Data->Filter in spreadsheet
51
 *
52
 */
42
 */
53
public class AutoFitlerWithPlusSign {
43
public class Fitler {
54
	/**
44
55
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
56
	 * Collect extra data when OpenOffice crashes.
57
	 */
58
	@Rule
45
	@Rule
59
	public Log LOG = new Log();
46
	public Log LOG = new Log();
60
47
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
48
	@Before
69
	public void setUp() throws Exception {
49
	public void setUp() throws Exception {
70
		initApp();
50
		app.start();
51
52
		// Create a new spreadsheet document
53
		startcenter.menuItem("File->New->Spreadsheet").select();
71
	}
54
	}
55
56
	@After
57
	public void tearDown() throws Exception {
58
		app.close();
59
	}
60
72
	/**
61
	/**
73
	 * 
62
	 * 
74
	 * Verify Chart Wizard dialog title words
63
	 * Verify Chart Wizard dialog title words
75
	 */
64
	 */
76
	@Test
65
	@Ignore("Bug 120076")
77
	public void test() {
66
	public void testAutoFilterWithPlusSign() {
78
		// Create a new text document
79
		startcenter.menuItem("File->New->Spreadsheet").select();
80
		sleep(3);
81
		String expect ="2+";
67
		String expect ="2+";
82
		CalcUtil.selectRange("A1");
68
		CalcUtil.selectRange("A1");
83
		typeKeys(expect + "<enter>");
69
		typeKeys(expect + "<enter>");
84
		assertEquals(expect,CalcUtil.getCellText("A1"));
70
		assertEquals(expect,CalcUtil.getCellText("A1"));
85
	}
71
	}
86
87
}
72
}
(-)src/testcase/sc/sort/SortOptionsCustomSortOrderPredefineFromNewList.java (-202 lines)
Lines 1-202 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 SortOptionsCustomSortOrderPredefineFromNewList {
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: custom sort order, predefined in preferences from new list
73
	 * @throws Exception
74
	 */
75
	@Test
76
	public void testSortOptionsCustomSortOrderPredefineFromNewList() throws Exception{
77
		
78
		// Dependencies start
79
		// Create a new spreadsheet document
80
		startcenter.menuItem("File->New->Spreadsheet").select();
81
		sleep(3);
82
83
		// "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists"
84
		typeKeys("<alt T O>");
85
		OptionsDlgList.select(15);	// Select "OpenOffice.org Spreadsheets"
86
		typeKeys("<shift =>");	// Expand "OpenOffice.org Spreadsheets" 
87
		OptionsDlgList.select(19);	// Select "Sort Lists"
88
		
89
		// Click "New" button, input "white,red,yellow,blue,green,black", press "Add" and "OK", close the document		
90
		OptionsDlg_New.click();
91
		typeKeys("white,red,yellow,blue,green,black");
92
		OptionsDlg_Add.click();
93
		sleep(0.5);
94
		OptionsDlg.ok();
95
		calc.menuItem("File->Close").select();
96
		// Dependencies end
97
				
98
		// Create a new spreadsheet document
99
		startcenter.menuItem("File->New->Spreadsheet").select();
100
		sleep(3);
101
		
102
		// Input some data
103
		String[][] data = new String[][] {
104
				{"Color"},
105
				{"black"},
106
				{"yellow"},
107
				{"blue"},
108
				{"black"},
109
				{"white"},
110
				{"red"},
111
		};
112
		String[][] expectedResultNoCustomSortOrder = new String[][] {
113
				{"Color"},
114
				{"black"},
115
				{"black"},
116
				{"blue"},
117
				{"red"},
118
				{"white"},
119
				{"yellow"},
120
		};
121
		String[][] expectedResultCustomSortOrder = new String[][] {
122
				{"Color"},
123
				{"white"},
124
				{"red"},
125
				{"yellow"},
126
				{"blue"},
127
				{"black"},
128
				{"black"},
129
		};
130
		CalcUtil.selectRange("A1");
131
		typeKeys("Color<down>black<down>yellow<down>blue<down>black<down>white<down>red");
132
		CalcUtil.selectRange("A2:A7");
133
		calc.menuItem("Format->Change Case->Lowercase").select();	// In case SC capitalize first letter automatically
134
		
135
		// "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color
136
		CalcUtil.selectRange("A1:A7");
137
		calc.menuItem("Data->Sort...").select();
138
		SortOptionsPage.select();
139
		SortOptionsPage_RangeContainsColumnLabels.check();
140
		SortOptionsPage_CustomSortOrder.uncheck();
141
		SortPage.select();
142
		SortPage_By1.select("Color");
143
		SortPage_Ascending1.check();
144
		SortPage.ok();	
145
		
146
		// Verify sorted result
147
		assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
148
		
149
		// Uodo/redo
150
		calc.menuItem("Edit->Undo: Sort").select();
151
		sleep(1);
152
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
153
		calc.menuItem("Edit->Redo: Sort").select();
154
		sleep(1);
155
		assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
156
		calc.menuItem("Edit->Undo: Sort").select();
157
		
158
		// Copy original data to sheet2
159
		CalcUtil.selectRange("A1:A7");
160
		calc.menuItem("Edit->Copy").select();
161
		CalcUtil.selectRange("Sheet2.A1");
162
		calc.menuItem("Edit->Paste").select();		
163
		sleep(1);
164
		
165
		// "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color
166
		calc.menuItem("Data->Sort...").select();
167
		SortOptionsPage.select();
168
		SortOptionsPage_RangeContainsColumnLabels.check();
169
		SortOptionsPage_CustomSortOrder.check();
170
		SortOptionsPage_CustomSortOrderList.select("white,red,yellow,blue,green,black");
171
		SortPage.select();
172
		SortPage_By1.select("Color");
173
		SortPage_Ascending1.check();
174
		SortPage.ok();	
175
		
176
		// Verify sorted result
177
		assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
178
		
179
		// Uodo/redo
180
		calc.menuItem("Edit->Undo: Sort").select();
181
		sleep(1);
182
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
183
		calc.menuItem("Edit->Redo: Sort").select();
184
		sleep(1);
185
		assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
186
		
187
		// Save and close document
188
		String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromNewList.ods");
189
		calc.menuItem("File->Save As...").select();
190
		FileUtil.deleteFile(saveTo);
191
		submitSaveDlg(saveTo);	
192
		calc.menuItem("File->Close").select();
193
		openStartcenter();
194
		
195
		// Reopen and verify sorted result
196
		startcenter.menuItem("File->Open...").select();
197
		submitOpenDlg(saveTo);
198
		calc.waitForExistence(10, 2);
199
		assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7"));
200
		assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7"));
201
	}	
202
}
(-)src/testcase/sc/validity/AllowDecimalEqual.java (-134 lines)
Lines 1-134 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 AllowDecimalEqual {
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 Decimal equal 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("Decimal");
85
		SC_ValidityDecimalCompareOperator.select("equal");
86
		SC_ValiditySourceInput.setText("0.33333333");
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("0.33333333");
98
		typeKeys("<enter>");
99
		assertEquals("0.33333333",CalcUtil.getCellText("Sheet1.A1"));
100
		
101
		CalcUtil.selectRange("Sheet1.A2");
102
		SC_CellInput.activate();
103
		typeKeys("=1/3");
104
		typeKeys("<enter>");
105
		assertEquals("0.33333333",CalcUtil.getCellText("Sheet1.A2"));
106
		
107
		CalcUtil.selectRange("Sheet1.A3");
108
		SC_CellInput.activate();
109
		typeKeys("0.3");
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("0.333333333");
118
		typeKeys("<enter>");
119
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
120
		ActiveMsgBox.ok();
121
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
122
123
		CalcUtil.selectRange("Sheet1.B2");
124
		SC_CellInput.activate();
125
		typeKeys("test");
126
		typeKeys("<enter>");
127
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
128
		ActiveMsgBox.ok();
129
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
130
131
		}
132
133
}
134
(-)src/testcase/sc/datapilot/TopNFunctionInGroupedField.java (-228 lines)
Lines 1-228 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
import org.openoffice.test.common.SystemUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
50
/**
51
 *
52
 *
53
 */
54
public class TopNFunctionInGroupedField {
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 add 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
		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
		DataPilotFieldSelect.click(1, 1);
99
		DataPilotFieldSelect.openContextMenu();
100
		menuItem("Add to Page").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("A3"));
108
		sleep(1);
109
		
110
		DataPilotFieldSelect.click(1,50);
111
		DataPilotFieldSelect.openContextMenu();
112
		menuItem("Add to Row").select();
113
		assertEquals("Date",CalcUtil.getCellText("A4"));
114
		sleep(1);
115
		
116
		DataPilotFieldSelect.click(1,70);
117
		DataPilotFieldSelect.openContextMenu();
118
		menuItem("Add to Data by->Sum").select();
119
		assertEquals("Sum - Order Number",CalcUtil.getCellInput("A3"));
120
		assertEquals("266773",CalcUtil.getCellText("J23"));
121
		sleep(1);
122
		
123
		CalcUtil.selectRange("B4:C4");
124
		SpreadSheetCells.openContextMenu();
125
		menuItem("Group->Group Selected Items").select();
126
		assertEquals("Name2",CalcUtil.getCellText("B3"));
127
		assertEquals("Name",CalcUtil.getCellText("C3"));
128
		assertEquals("Group1",CalcUtil.getCellText("D4"));
129
		assertEquals("266773",CalcUtil.getCellText("J24"));
130
		sleep(1);
131
		
132
		CalcUtil.selectRange("A1");
133
		sleep(1);
134
		
135
		// the Display resolution is 1280 * 1050 on windows and Linux and 1920 * 1080 on Mac
136
		if(SystemUtil.isWindows()){
137
			SpreadSheetCells.click(238, 43);
138
		}
139
		else if(SystemUtil.isLinux()){
140
			SpreadSheetCells.click(267, 43);
141
		}
142
		else if(SystemUtil.isMac()){
143
			SpreadSheetCells.click(238, 43);
144
		}
145
146
		typeKeys("<tab>");
147
		typeKeys("<tab>");
148
		typeKeys("<tab>");
149
		typeKeys("<tab>");
150
		typeKeys("<tab>");
151
		typeKeys("<tab>");
152
		typeKeys("<enter>");
153
		OnlyDisplayTopNItemCheckBox.check();
154
		NumberOfItemShowInTopNEditBox.setText("4");
155
		FieldTopNSettingDialog.ok();
156
		sleep(1);
157
		
158
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
159
		assertEquals("51299",CalcUtil.getCellText("B24"));
160
		
161
		assertEquals("Group1",CalcUtil.getCellText("C4"));
162
		assertEquals("71806",CalcUtil.getCellText("C24"));
163
		assertEquals("",CalcUtil.getCellText("D4"));
164
		assertEquals("Amy Zhao",CalcUtil.getCellText("C5"));
165
		assertEquals("Anne Lee",CalcUtil.getCellText("D5"));
166
		assertEquals("20528",CalcUtil.getCellText("D24"));
167
		
168
		assertEquals("Joe Liu",CalcUtil.getCellText("E4"));
169
		assertEquals("41056",CalcUtil.getCellText("E24"));
170
		
171
		assertEquals("Kevin Wang",CalcUtil.getCellText("F4"));
172
		assertEquals("30771",CalcUtil.getCellText("F24"));
173
		
174
		assertEquals("Total Result",CalcUtil.getCellText("G4"));
175
		assertEquals("215460",CalcUtil.getCellText("G24"));
176
		sleep(1);
177
		
178
		typeKeys("<$undo>");
179
		assertEquals("Name2",CalcUtil.getCellText("B3"));
180
		assertEquals("Name",CalcUtil.getCellText("C3"));
181
		assertEquals("Group1",CalcUtil.getCellText("D4"));
182
		assertEquals("266773",CalcUtil.getCellText("J24"));
183
		
184
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
185
		assertEquals("51299",CalcUtil.getCellText("B24"));
186
		
187
		assertEquals("Emmy Ma",CalcUtil.getCellText("C4"));
188
		assertEquals("20518",CalcUtil.getCellText("C24"));
189
		assertEquals("Group1",CalcUtil.getCellText("D4"));
190
		assertEquals("Emmy Ma",CalcUtil.getCellText("C5"));
191
		assertEquals("Amy Zhao",CalcUtil.getCellText("D5"));
192
		assertEquals("71806",CalcUtil.getCellText("D24"));
193
		
194
		assertEquals("",CalcUtil.getCellText("E4"));
195
		assertEquals("20528",CalcUtil.getCellText("E24"));
196
		
197
		assertEquals("Harry Wu",CalcUtil.getCellText("F4"));
198
		assertEquals("10265",CalcUtil.getCellText("F24"));
199
		
200
		assertEquals("Jerry Lu",CalcUtil.getCellText("G4"));
201
		assertEquals("20530",CalcUtil.getCellText("G24"));
202
		
203
		assertEquals("Total Result",CalcUtil.getCellText("J4"));
204
		assertEquals("266773",CalcUtil.getCellText("J24"));
205
		sleep(1);
206
		
207
		typeKeys("<$redo>");
208
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
209
		assertEquals("51299",CalcUtil.getCellText("B24"));
210
		
211
		assertEquals("Group1",CalcUtil.getCellText("C4"));
212
		assertEquals("71806",CalcUtil.getCellText("C24"));
213
		assertEquals("",CalcUtil.getCellText("D4"));
214
		assertEquals("Amy Zhao",CalcUtil.getCellText("C5"));
215
		assertEquals("Anne Lee",CalcUtil.getCellText("D5"));
216
		assertEquals("20528",CalcUtil.getCellText("D24"));
217
		
218
		assertEquals("Joe Liu",CalcUtil.getCellText("E4"));
219
		assertEquals("41056",CalcUtil.getCellText("E24"));
220
		
221
		assertEquals("Kevin Wang",CalcUtil.getCellText("F4"));
222
		assertEquals("30771",CalcUtil.getCellText("F24"));
223
		
224
		assertEquals("Total Result",CalcUtil.getCellText("G4"));
225
		assertEquals("215460",CalcUtil.getCellText("G24"));
226
	}
227
228
}
(-)src/testcase/sc/validity/DefaultErrorAlertMessage.java (-107 lines)
Lines 1-107 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 DefaultErrorAlertMessage {
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 default message of Error Alert in Validity.
73
	 */
74
	@Test
75
	public void testDefaultErrorAlertMessage() {
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.check();
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("OpenOffice.org Spreadsheets",ActiveMsgBox.getCaption());
100
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
101
		ActiveMsgBox.ok();
102
		assertEquals("",CalcUtil.getCellText("Sheet1.A1"));
103
		
104
		}
105
106
}
107
(-)src/testcase/sc/sort/RowsSortWithOptionsCaseSensitive.java (-129 lines)
Lines 1-129 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
34
import org.junit.Before;
35
import org.junit.Ignore;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.common.FileUtil;
39
40
import testlib.CalcUtil;
41
import testlib.Log;
42
43
/**
44
 *
45
 */
46
public class RowsSortWithOptionsCaseSensitive {
47
	
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
54
	public Log LOG = new Log();
55
	
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
65
	public void setUp() throws Exception {
66
		initApp();
67
	}
68
	
69
	/**
70
	 * Test rows sort with options setting: case sensitive 
71
	 * @throws Exception
72
	 */
73
	@Test
74
	public void testRowsSortWithOptionsCaseSensitive() throws Exception{
75
		
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
81
		String[][] data = new String[][] {
82
				{"D"},
83
				{"C"},
84
				{"B"},
85
				{"A"},
86
				{"a"},
87
		};
88
		String[][] expectedSortedResult = new String[][] {
89
				{"a"},
90
				{"A"},
91
				{"B"},
92
				{"C"},
93
				{"D"},
94
		};
95
		CalcUtil.selectRange("A1");
96
		typeKeys("1ColumnName<down>D<down>C<down>B<down>A<down>a<down>");
97
		CalcUtil.selectRange("A6");
98
		calc.menuItem("Format->Change Case->Lowercase").select();	// In case SC capitalize first letter automatically
99
		
100
		// "Data->Sort...", choose "Ascending", check "Case sensitive"
101
		calc.menuItem("Data->Sort...").select();
102
		SortOptionsPage.select();
103
		SortOptionsPage_CaseSensitive.check();
104
		SortOptionsPage.ok();		
105
		
106
		// Verify sorted result
107
		assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
108
		
109
		// Uodo/redo
110
		calc.menuItem("Edit->Undo: Sort").select();
111
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A2:A6"));
112
		calc.menuItem("Edit->Redo: Sort").select();
113
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
114
		
115
		// Save and close document
116
		String saveTo = fullPath("temp/" + "RowsSortWithOptionsCaseSensitive.ods");
117
		calc.menuItem("File->Save As...").select();
118
		FileUtil.deleteFile(saveTo);
119
		submitSaveDlg(saveTo);	
120
		calc.menuItem("File->Close").select();
121
		openStartcenter();
122
		
123
		// Reopen and verify sorted result
124
		startcenter.menuItem("File->Open...").select();
125
		submitOpenDlg(saveTo);
126
		calc.waitForExistence(10, 2);
127
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
128
	}
129
}
(-)src/testcase/sc/chart/ChartDialogCancelBack.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
/**
25
 * 
26
 */
27
package testcase.sc.chart;
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
 */
53
public class ChartDialogCancelBack {
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
	 * Test cancel and back button in chart wizard dialog
76
	 * 
77
	 * @throws java.lang.Exception
78
	 */
79
	@Test
80
	public void test() {
81
		//Create a new text document
82
		startcenter.menuItem("File->New->Spreadsheet").select();
83
		sleep(3);
84
		calc.menuItem("Insert->Chart...").select();
85
		sleep(1);
86
		WizardNextButton.click();
87
		sleep(1);
88
		assertTrue(ChartRangeChooseTabPage.isEnabled());
89
		WizardBackButton.click();
90
		sleep(1);
91
		assertTrue(ChartTypeChooseTabPage.isEnabled());
92
		Chart_Wizard.cancel();
93
		sleep(1);
94
		assertFalse(Chart_Wizard.exists());
95
	}
96
97
}
(-)src/testcase/sc/validity/ValidityDateSupport1024Columns.java (-44 / +23 lines)
Lines 46-87 Link Here
46
public class ValidityDateSupport1024Columns {
46
public class ValidityDateSupport1024Columns {
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();
69
	}
56
	}
70
	
57
58
	@After
59
	public void tearDown() throws Exception {
60
		app.close();
61
	}
62
71
	/**
63
	/**
72
	 * test Allow Greater than or equal to Date type in Validity, support 1024 columns.
64
	 * test Allow Greater than or equal to Date type in Validity, support 1024 columns.
73
	 */
65
	 */
74
	@Test
66
	@Test
75
	public void testValidityDateSupport1024Columns() {
67
	public void testValidityDateSupport1024Columns() {
76
		startcenter.menuItem("File->New->Spreadsheet").select();
68
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(1);
78
		
79
		CalcUtil.selectRange("Sheet1.ALM1000");
80
		CalcUtil.selectRange("Sheet1.ALM1000:Sheet1.ALO1005");	
69
		CalcUtil.selectRange("Sheet1.ALM1000:Sheet1.ALO1005");	
81
		
82
		calc.menuItem("Data->Validity...").select();	
70
		calc.menuItem("Data->Validity...").select();	
83
		sleep(1);	
71
84
		
85
		SC_ValidityCriteriaTabpage.select();
72
		SC_ValidityCriteriaTabpage.select();
86
		SC_ValidityCriteriaAllowList.select("Date");
73
		SC_ValidityCriteriaAllowList.select("Date");
87
		SC_ValidityDecimalCompareOperator.select("greater than");
74
		SC_ValidityDecimalCompareOperator.select("greater than");
Lines 90-128 Link Here
90
		SC_ValidityShowErrorMessage.check();
77
		SC_ValidityShowErrorMessage.check();
91
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
78
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
92
		SC_ValidityErrorMessage.setText("Invalid value");
79
		SC_ValidityErrorMessage.setText("Invalid value");
93
		typeKeys("<tab>");
80
		SC_ValidityErrorAlertTabPage.ok();
94
		typeKeys("<enter>");	
81
95
		sleep(1);
96
				
97
		CalcUtil.selectRange("Sheet1.ALM1001");
82
		CalcUtil.selectRange("Sheet1.ALM1001");
98
		SC_CellInput.activate();
83
		SC_InputBar_Input.activate();
99
		typeKeys("02/01/08");
84
		typeKeys("02/01/08<enter>");
100
		typeKeys("<enter>");
101
		assertEquals("02/01/08",CalcUtil.getCellText("Sheet1.ALM1001"));
85
		assertEquals("02/01/08",CalcUtil.getCellText("Sheet1.ALM1001"));
102
		
86
103
		CalcUtil.selectRange("Sheet1.ALM1002");
87
		CalcUtil.selectRange("Sheet1.ALM1002");
104
		SC_CellInput.activate();
88
		SC_InputBar_Input.activate();
105
		typeKeys("01/02/08");
89
		typeKeys("01/02/08<enter>");
106
		typeKeys("<enter>");
107
		assertEquals("01/02/08",CalcUtil.getCellText("Sheet1.ALM1002"));
90
		assertEquals("01/02/08",CalcUtil.getCellText("Sheet1.ALM1002"));
108
		
91
109
		CalcUtil.selectRange("Sheet1.ALM1003");
92
		CalcUtil.selectRange("Sheet1.ALM1003");
110
		SC_CellInput.activate();
93
		SC_InputBar_Input.activate();
111
		typeKeys("01/01/08");
94
		typeKeys("01/01/08<enter>");
112
		typeKeys("<enter>");
113
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
95
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
114
		ActiveMsgBox.ok();
96
		ActiveMsgBox.ok();
115
		assertEquals("",CalcUtil.getCellText("Sheet1.ALM1003"));
97
		assertEquals("",CalcUtil.getCellText("Sheet1.ALM1003"));
116
98
117
		CalcUtil.selectRange("Sheet1.AML1003");
99
		CalcUtil.selectRange("Sheet1.AML1003");
118
		SC_CellInput.activate();
100
		SC_InputBar_Input.activate();
119
		typeKeys("12/31/07");
101
		typeKeys("12/31/07<enter>");
120
		typeKeys("<enter>");
121
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
102
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
122
		ActiveMsgBox.ok();
103
		ActiveMsgBox.ok();
123
		assertEquals("",CalcUtil.getCellText("Sheet1.AML1003"));
104
		assertEquals("",CalcUtil.getCellText("Sheet1.AML1003"));
124
		
105
	}
125
		}
126
127
}
106
}
128
107
(-)src/testcase/sc/validity/AllowTimeBetween.java (-180 lines)
Lines 1-180 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 AllowTimeBetween {
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 between  in Validity.
73
	 */
74
	@Test
75
	public void testAllowTimeBetween() {
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("between");
86
		SC_ValiditySourceInput.setText("27:00");
87
		SC_ValidityMaxValueInput.setText("21:00");
88
		SC_ValidityErrorAlertTabPage.select();
89
		SC_ValidityShowErrorMessage.check();
90
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
91
		SC_ValidityErrorMessage.setText("Invalid value");
92
		typeKeys("<tab>");
93
		typeKeys("<enter>");	
94
		sleep(1);
95
				
96
		CalcUtil.selectRange("Sheet1.A1");
97
		SC_CellInput.activate();
98
		typeKeys("21:00");
99
		typeKeys("<enter>");
100
		assertEquals("09:00:00 PM",CalcUtil.getCellText("Sheet1.A1"));
101
		
102
		CalcUtil.selectRange("Sheet1.A2");
103
		SC_CellInput.activate();
104
		typeKeys("27:00");
105
		typeKeys("<enter>");
106
		assertEquals("27:00:00",CalcUtil.getCellText("Sheet1.A2"));
107
		
108
		CalcUtil.selectRange("Sheet1.A3");
109
		SC_CellInput.activate();
110
		typeKeys("1.125");
111
		typeKeys("<enter>");
112
		assertEquals("1.125",CalcUtil.getCellText("Sheet1.A3"));
113
		
114
		CalcUtil.selectRange("Sheet1.A4");
115
		SC_CellInput.activate();
116
		typeKeys("0.875");
117
		typeKeys("<enter>");
118
		assertEquals("0.875",CalcUtil.getCellText("Sheet1.A4"));
119
				
120
		CalcUtil.selectRange("Sheet1.B1");
121
		SC_CellInput.activate();
122
		typeKeys("03:00:01");
123
		typeKeys("<enter>");
124
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
125
		ActiveMsgBox.ok();
126
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
127
128
		CalcUtil.selectRange("Sheet1.B2");
129
		SC_CellInput.activate();
130
		typeKeys("20:59:59");
131
		typeKeys("<enter>");
132
		sleep(1);
133
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
134
		ActiveMsgBox.ok();
135
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
136
		
137
		CalcUtil.selectRange("Sheet1.B3");
138
		SC_CellInput.activate();
139
		typeKeys("1.126");
140
		typeKeys("<enter>");
141
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
142
		ActiveMsgBox.ok();
143
		assertEquals("",CalcUtil.getCellText("Sheet1.B3"));
144
145
		CalcUtil.selectRange("Sheet1.B4");
146
		SC_CellInput.activate();
147
		typeKeys("0.874");
148
		typeKeys("<enter>");
149
		sleep(1);
150
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
151
		ActiveMsgBox.ok();
152
		assertEquals("",CalcUtil.getCellText("Sheet1.B4"));
153
		
154
		CalcUtil.selectRange("Sheet1.C1");
155
		SC_CellInput.activate();
156
		typeKeys("test");
157
		typeKeys("<enter>");
158
		sleep(1);
159
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
160
		ActiveMsgBox.ok();
161
		assertEquals("",CalcUtil.getCellText("Sheet1.C1"));
162
		
163
		CalcUtil.selectRange("Sheet1.C2");
164
		SC_CellInput.activate();
165
		typeKeys("24:00");
166
		typeKeys("<enter>");
167
		assertEquals("24:00:00",CalcUtil.getCellText("Sheet1.C2"));
168
		
169
		CalcUtil.selectRange("Sheet1.C3");
170
		SC_CellInput.activate();
171
		typeKeys("12:00");
172
		typeKeys("<enter>");
173
		sleep(1);
174
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
175
		ActiveMsgBox.ok();
176
		assertEquals("",CalcUtil.getCellText("Sheet1.C3"));
177
		}
178
179
}
180
(-)src/testcase/sc/celltext/InsertColumnsFromMainMenu.java (-115 lines)
Lines 1-115 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.celltext;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.awt.Rectangle;
30
import java.io.File;
31
32
import org.junit.After;
33
import static org.junit.Assert.*;
34
import static org.openoffice.test.vcl.Tester.*;
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
import org.openoffice.test.common.GraphicsUtil;
42
43
import testlib.CalcUtil;
44
import testlib.Log;
45
46
public class InsertColumnsFromMainMenu {
47
	/**
48
	 * TestCapture helps us to do
49
	 * 1. Take a screenshot when failure occurs.
50
	 * 2. Collect extra data when OpenOffice crashes.
51
	 */	
52
	@Rule
53
	public Log LOG = new Log();
54
	
55
	/**
56
	 * initApp helps us to do 
57
	 * 1. Patch the OpenOffice to enable automation if necessary.
58
	 * 2. Start OpenOffice with automation enabled if necessary.
59
	 * 3. Reset OpenOffice to startcenter.
60
	 * 
61
	 * @throws java.lang.Exception
62
	 */
63
	@Before
64
	public void setUp() throws Exception {
65
		initApp();
66
	}
67
	
68
	/**
69
	 * Insert columns from main menu.
70
	 * 
71
	 * @throws Exception
72
	 */
73
	@Test
74
	public void insertColumnsFromMainMenu(){
75
		//Create a new text document
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(3);
78
		//input Test123 into cell A1
79
		String expect="Test123";
80
		CalcUtil.selectRange("A1");
81
		typeKeys(expect+"<enter>");
82
		CalcUtil.selectRange("A1");
83
		//Insert 1 columns before column A form main menu,so Cell A1 move B1, check it
84
		calc.menuItem("Insert->Columns...").select();
85
		assertEquals("1",SC_NumberOfColumnsRowsToInsert.getText());
86
		SC_InsertColumnsRowsdialog.ok();
87
		sleep(1);
88
		assertEquals(expect,CalcUtil.getCellText("B1"));
89
		
90
		//Check the default insert column number is same as columns you select
91
		CalcUtil.selectRange("E1");
92
		typeKeys(expect + "<enter>");
93
		CalcUtil.selectRange("A1:D4");
94
		calc.menuItem("Insert->Columns...").select();
95
		assertEquals("4",SC_NumberOfColumnsRowsToInsert.getText());
96
		
97
		//insert 4 column number after select column, then E1 move to I1, check it
98
		SC_InsertColumnsRowsAfterSelectColumn.check();
99
		assertTrue(SC_InsertColumnsRowsAfterSelectColumn.isEnabled());
100
		SC_InsertColumnsRowsdialog.ok();
101
		sleep(1);
102
		assertEquals(expect,CalcUtil.getCellText("I1"));
103
		
104
		//input 1024 in insert columns number, then the warning dialog pop up check it
105
		CalcUtil.selectRange("A1");
106
		calc.menuItem("Insert->Columns...").select();
107
		SC_NumberOfColumnsRowsToInsert.setText("1024");
108
		SC_InsertColumnsRowsdialog.ok();
109
		assertEquals("Filled cells cannot be shifted" + "\n"
110
				+ "beyond the sheet.",
111
				ActiveMsgBox.getMessage());
112
		typeKeys("<enter>");
113
	}
114
115
}
(-)src/testcase/sc/validity/FFCNotIgnoreBlank.java (-98 lines)
Lines 1-98 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 FFCNotIgnoreBlank {
53
	private static IDList idList = new IDList(new File("./ids"));
54
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
55
	/**
56
	 * TestCapture helps us to doCalcUtil
57
	 * 1. Take a screenshot when failure occurs.
58
	 * 2. Collect extra data when OpenOffice crashes.
59
	 */	
60
	@Rule
61
	public Log LOG = new Log();
62
	
63
	/**
64
	 * initApp helps us to do 
65
	 * 1. Patch the OpenOffice to enable automation if necessary.
66
	 * 2. Start OpenOffice with automation enabled if necessary.
67
	 * 3. Reset OpenOffice to startcenter.
68
	 * 
69
	 * @throws java.lang.Exception
70
	 */
71
	@Before
72
	public void setUp() throws Exception {
73
		initApp();
74
	}
75
	
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
		startcenter.menuItem("File->Open").select();
86
		submitOpenDlg(file);
87
		
88
		CalcUtil.selectRange("F5");
89
		SC_CellInput.activate();
90
		typeKeys("<backspace>");
91
		typeKeys("<enter>");
92
	
93
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
94
	}
95
	
96
97
	
98
}
(-)src/testcase/sc/sort/SortOptionsMultipleSortDataOverlap.java (-169 lines)
Lines 1-169 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 SortOptionsMultipleSortDataOverlap {
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: multiple sort, data overlap
73
	 * @throws Exception
74
	 */
75
	@Test
76
	public void testSortOptionsMultipleSortDataOverlap() 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[][] data1 = new String[][] {
84
				{"D"},
85
				{"C"},
86
				{"B"},
87
				{"A"},
88
				{"E"},
89
		};
90
		String[][] expectedSortedResult1 = new String[][] {
91
				{"A"},
92
				{"B"},
93
				{"C"},
94
				{"D"},
95
				{"E"},
96
		};
97
		String[][] data2 = new String[][] {
98
				{"4"},
99
				{"2"},
100
				{"5"},
101
				{"1"},
102
				{"3"},
103
		};
104
		String[][] expectedSortedResultDataOverlap = new String[][] {
105
				{"A"},
106
				{"B"},
107
				{"C"},
108
				{"1"},
109
				{"2"},
110
				{"3"},
111
				{"4"},
112
				{"5"},
113
		};
114
		CalcUtil.selectRange("A1");
115
		typeKeys("D<down>C<down>B<down>A<down>E");
116
		
117
		// "Data->Sort...", uncheck "Range contains column labels", sort first by "Column A", "Ascending"
118
		calc.menuItem("Data->Sort...").select();
119
		SortOptionsPage.select();
120
		SortOptionsPage_RangeContainsColumnLabels.uncheck();
121
		SortPage.select();
122
		SortPage_By1.select("Column A");
123
		SortPage_Ascending1.check();
124
		SortPage.ok();		
125
		
126
		// Verify sorted result
127
		assertArrayEquals("Sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
128
		
129
		// Uodo/redo
130
		calc.menuItem("Edit->Undo: Sort").select();
131
		assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5"));
132
		calc.menuItem("Edit->Redo: Sort").select();
133
		assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
134
		
135
		// Input data2 into same sheet, data1 and data2 are not overlapped
136
		CalcUtil.selectRange("G10");
137
		typeKeys("4<down>2<down>5<down>1<down>3");
138
		
139
		// Focus on data2, "Data->Sort...", "Copy result to" partially overlap with data1, sort first by "Column G", "Ascending"
140
		CalcUtil.selectRange("G10");
141
		calc.menuItem("Data->Sort...").select();
142
		SortOptionsPage.select();
143
		SortOptionsPage_RangeContainsColumnLabels.uncheck();
144
		SortOptionsPage_CopyResultTo.check();
145
		SortOptionsPage_CopyResultToEdit.setText("A4");
146
		SortPage.select();
147
		SortPage_By1.select("Column G");
148
		SortPage_Ascending1.check();
149
		SortPage.ok();			
150
		
151
		// Verify sorted result
152
		assertArrayEquals("Sorted result data overlap", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8"));
153
		
154
		// Save and close document
155
		String saveTo = fullPath("temp/" + "SortOptionsMultipleSortDataOverlap.ods");
156
		calc.menuItem("File->Save As...").select();
157
		FileUtil.deleteFile(saveTo);
158
		submitSaveDlg(saveTo);	
159
		calc.menuItem("File->Close").select();
160
		openStartcenter();
161
		
162
		// Reopen and verify sorted result
163
		startcenter.menuItem("File->Open...").select();
164
		submitOpenDlg(saveTo);
165
		calc.waitForExistence(10, 2);
166
		assertArrayEquals("Saved sorted result", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8"));
167
		assertArrayEquals("Original data2", data2, CalcUtil.getCellTexts("G10:G14"));
168
	}
169
}
(-)src/testcase/sc/datapilot/SortFunctionInGroupedField.java (-159 lines)
Lines 1-159 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 SortFunctionInGroupedField {
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.getCellInput("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
		DataPilotFieldOptionSortTabPageDialog.select();
134
		
135
		DataPilotFieldOptionSortDescendingRadioButton.check();
136
		DataPilotFieldOptionFieldTabPageDialog.select();
137
		DataPilotFieldOptionFieldTabPageDialog.ok();
138
		sleep(1);
139
		
140
		assertEquals("Kevin Wang",CalcUtil.getCellText("B4"));
141
		assertEquals("Group1",CalcUtil.getCellText("F4"));
142
		assertEquals("Bill Zhang",CalcUtil.getCellText("I4"));
143
		assertEquals("266773",CalcUtil.getCellText("J24"));
144
		
145
		typeKeys("<$undo>");
146
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
147
		assertEquals("Group1",CalcUtil.getCellText("D4"));
148
		assertEquals("Kevin Wang",CalcUtil.getCellText("I4"));
149
		assertEquals("266773",CalcUtil.getCellText("J24"));
150
		sleep(1);
151
		
152
		typeKeys("<$redo>");
153
		assertEquals("Kevin Wang",CalcUtil.getCellText("B4"));
154
		assertEquals("Group1",CalcUtil.getCellText("F4"));
155
		assertEquals("Bill Zhang",CalcUtil.getCellText("I4"));
156
		assertEquals("266773",CalcUtil.getCellText("J24"));
157
	}
158
159
}
(-)src/testcase/sc/sort/SortCriteriaSortFirstBy.java (-150 lines)
Lines 1-150 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 SortCriteriaSortFirstBy {
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 first by
73
	 * @throws Exception
74
	 */
75
	@Test
76
	public void testSortCriteriaSortFirstBy() 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
				{"2", "BC"},
88
				{"6", "GE"},
89
				{"1", "AB"},
90
		};
91
		String[][] expectedResultSortByColumnBAscending = new String[][] {
92
				{"1", "AB"},
93
				{"2", "BC"},
94
				{"3", "D"},
95
				{"4", "E"},
96
				{"5", "FLK"},
97
				{"6", "GE"},
98
		};
99
		String[][] expectedResultSortByColumnADescending = new String[][] {
100
				{"6", "GE"},
101
				{"5", "FLK"},
102
				{"4", "E"},
103
				{"3", "D"},
104
				{"2", "BC"},
105
				{"1", "AB"},
106
		};
107
		CalcUtil.selectRange("A1");
108
		typeKeys("3<down>5<down>4<down>2<down>6<down>1");
109
		CalcUtil.selectRange("B1");
110
		typeKeys("D<down>FLK<down>E<down>BC<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", expectedResultSortByColumnBAscending, 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", expectedResultSortByColumnBAscending, CalcUtil.getCellTexts("A1:B6"));
128
		calc.menuItem("Edit->Undo: Sort").select();
129
		
130
		// Save and close document
131
		String saveTo = fullPath("temp/" + "SortCriteriaSortFirstBy.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...", choose "Descending", sort first by Column A
139
		startcenter.menuItem("File->Open...").select();
140
		submitOpenDlg(saveTo);
141
		calc.waitForExistence(10, 2);
142
		calc.menuItem("Data->Sort...").select();
143
		SortPage_Descending1.check();
144
		SortPage_By1.select("Column A");
145
		SortPage.ok();		
146
147
		// Verify sorted result
148
		assertArrayEquals("Saved sorted result", expectedResultSortByColumnADescending, CalcUtil.getCellTexts("A1:B6"));
149
	}	
150
}
(-)src/testcase/sc/validity/AllowLessThanTextLength.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
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 AllowLessThanTextLength {
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,  less than  in Validity.
73
	 */
74
	@Test
75
	public void testAllowLessThanTextLength() {
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("less than");
86
		SC_ValiditySourceInput.setText("10");
87
		
88
		SC_ValidityInputHelpTabPage.select();
89
		SC_ValidityInputHelpCheckbox.check();
90
		SC_ValidityInputHelpTitle.setText("Help Info Title");
91
		SC_ValidityHelpMessage.setText("help info");
92
				
93
		SC_ValidityErrorAlertTabPage.select();
94
		SC_ValidityShowErrorMessage.check();
95
		SC_ValidityErrorAlertActionList.select("Information");
96
		SC_ValidityErrorMessageTitle.setText("Notes to enter");
97
		SC_ValidityErrorMessage.setText("Invalid value");
98
		typeKeys("<tab>");
99
		typeKeys("<enter>");	
100
		sleep(1);
101
				
102
		
103
		CalcUtil.selectRange("Sheet1.A1");
104
		SC_CellInput.activate();
105
		typeKeys("testtesttesttest");
106
		typeKeys("<enter>");
107
		ActiveMsgBox.ok();
108
		assertEquals("Testtesttesttest",CalcUtil.getCellText("Sheet1.A1"));
109
		
110
		CalcUtil.selectRange("Sheet1.A2");
111
		SC_CellInput.activate();
112
		typeKeys("sfsafsddddddd");
113
		typeKeys("<enter>");
114
		sleep(1);
115
		ActiveMsgBox.focus();
116
		typeKeys("<tab>");
117
		typeKeys("<enter>");
118
		assertEquals("",CalcUtil.getCellText("Sheet1.A2"));
119
		
120
		CalcUtil.selectRange("Sheet1.A2");
121
		SC_CellInput.activate();
122
		typeKeys("10");
123
		typeKeys("<enter>");
124
		sleep(1);
125
		assertEquals("10",CalcUtil.getCellText("Sheet1.A2"));
126
		
127
		
128
//		CalcUtil.selectRange("Sheet1.A2");
129
		SC_CellInput.activate();
130
		typeKeys("<backspace>");
131
		typeKeys("<backspace>");
132
		typeKeys("ok");
133
		typeKeys("<enter>");
134
		assertEquals("Ok",CalcUtil.getCellText("Sheet1.A2"));
135
136
137
		}
138
139
}
140
(-)src/testcase/sc/validity/ValidityUICellRange.java (-87 lines)
Lines 1-87 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 ValidityUICellRange {
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(Criteria: Cell range).
66
	 */
67
	@Test
68
	public void testValidityUICellRange() {
69
		startcenter.menuItem("File->New->Spreadsheet").select();
70
		sleep(1);
71
		calc.menuItem("Data->Validity...").select();
72
		sleep(1);
73
		SC_ValidityCriteriaTabpage.select();
74
		SC_ValidityCriteriaAllowList.select("Cell range");
75
		
76
		assertEquals(true,SC_ValidityAllowBlankCells.isChecked());
77
		assertEquals(true,SC_ValidityShowSelectionList.isChecked());
78
		assertEquals(false,SC_ValiditySortEntriesAscending.isChecked());
79
		assertEquals(true,SC_ValidityAllowBlankCells.isEnabled());
80
		assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled());
81
		assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled());
82
		assertEquals(true,SC_ValiditySourcePicker.isEnabled());
83
84
	}
85
86
}
87
(-)src/testcase/sc/validity/AllowList.java (-118 lines)
Lines 1-118 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 AllowList {
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 list.
73
	 */
74
	@Test
75
	public void testAllowListSpecialChar() {
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("List");
85
		SC_ValidityEntries.focus();
86
		typeKeys("a");
87
		typeKeys("<enter>");
88
		typeKeys("b");
89
		typeKeys("<tab>");
90
		typeKeys("<enter>");
91
		int[] A1loc=CalcUtil.parseLocation("A1");
92
		calc.rightClick(A1loc[1], A1loc[0]);
93
		typeKeys("<shift s>");
94
		typeKeys("<shift s>");
95
		typeKeys("<enter>");
96
		sleep(1);
97
		typeKeys("<down>");
98
		typeKeys("<enter>");
99
		assertEquals("b",CalcUtil.getCellText("Sheet1.A1"));
100
		
101
		calc.rightClick(A1loc[1], A1loc[0]);
102
		typeKeys("<shift s>");
103
		typeKeys("<shift s>");
104
		typeKeys("<enter>");
105
		sleep(1);
106
		typeKeys("<enter>");
107
		assertEquals("a",CalcUtil.getCellText("Sheet1.A1"));
108
		
109
		CalcUtil.selectRange("Sheet1.B2");
110
		SC_CellInput.activate();
111
		typeKeys("test");
112
		typeKeys("<enter>");
113
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
114
		ActiveMsgBox.ok();
115
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
116
		
117
	}
118
}
(-)src/testcase/sc/datapilot/DragMoveFunctionOfGroupedField.java (-151 lines)
Lines 1-151 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 DragMoveFunctionOfGroupedField {
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 Verify the Drag/Move 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
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
92
			DataPilotAutomaticallyUpdateCheckBox.check();
93
			
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
		DataPilotColumnArea.click(1,1);
131
		DataPilotColumnArea.openContextMenu();
132
		menuItem("Move to Row").select();
133
		assertEquals("Name2",CalcUtil.getCellText("B4"));
134
		assertEquals("Group1",CalcUtil.getCellText("B6"));
135
		assertEquals("266773",CalcUtil.getCellText("K31"));
136
		sleep(1);
137
		
138
		typeKeys("<$undo>");
139
		assertEquals("Name2",CalcUtil.getCellText("B3"));
140
		assertEquals("Name",CalcUtil.getCellText("C3"));
141
		assertEquals("Group1",CalcUtil.getCellText("D4"));
142
		assertEquals("266773",CalcUtil.getCellText("J24"));
143
		sleep(1);
144
		
145
		typeKeys("<$redo>");
146
		assertEquals("Name2",CalcUtil.getCellText("B4"));
147
		assertEquals("Group1",CalcUtil.getCellText("B6"));
148
		assertEquals("266773",CalcUtil.getCellText("K31"));
149
	}
150
151
}
(-)src/testcase/sc/datapilot/RemoveFieldsDiscardChange.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.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 RemoveFieldsDiscardChange {
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 remove 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
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
122
		
123
		DataPilotColumnArea.drag(1, 1, -30, 1);
124
		assertEquals("Name",CalcUtil.getCellText("B3"));
125
		assertEquals("266773",CalcUtil.getCellText("J23"));
126
		sleep(1);
127
		
128
		DataPilotPaneRowArea.click(1,1);
129
		DataPilotPaneRowArea.openContextMenu();
130
		menuItem("Remove").select();
131
		assertEquals("Date",CalcUtil.getCellText("A4"));
132
		assertEquals("266773",CalcUtil.getCellText("J23"));
133
		sleep(1);
134
		
135
		DataPilotPanePageArea.drag(1, 1, -30, 1);
136
		assertEquals("Locale",CalcUtil.getCellText("A1"));
137
		assertEquals("266773",CalcUtil.getCellText("J23"));
138
		sleep(1);
139
		
140
		DataPiloPaneDataArea.openContextMenu();
141
		menuItem("Remove").select();
142
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
143
		assertEquals("266773",CalcUtil.getCellText("J23"));
144
		
145
		CalcUtil.selectRange("B25");
146
		ActiveMsgBox.yes();
147
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
148
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
149
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
150
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
151
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
152
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
153
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
154
		
155
		DataPilotAutomaticallyUpdateCheckBox.check();
156
	}
157
158
}
(-)src/testcase/sc/sort/SortOptionsCustomSortOrderPredefineFromCopyList.java (-215 lines)
Lines 1-215 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 SortOptionsCustomSortOrderPredefineFromCopyList {
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: custom sort order, predefined in preferences from copy list
73
	 * @throws Exception
74
	 */
75
	@Test
76
	public void testSortOptionsCustomSortOrderPredefineFromCopyList() throws Exception{
77
		
78
		// Dependencies start
79
		// Create a new spreadsheet document
80
		startcenter.menuItem("File->New->Spreadsheet").select();
81
		sleep(3);
82
		
83
		// Input some data
84
//		String[][] copiedSortList = new String[][] {
85
//				{"red"},
86
//				{"yellow"},
87
//				{"blue"},
88
//				{"green"},
89
//				{"white"},
90
//				{"black"},
91
//		};		
92
		CalcUtil.selectRange("A1");
93
		typeKeys("red<down>yellow<down>blue<down>green<down>white<down>black");
94
		CalcUtil.selectRange("A1:A6");
95
		calc.menuItem("Format->Change Case->Lowercase").select();	// In case SC capitalize first letter automatically
96
97
		// Select the cell range, "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists"
98
		CalcUtil.selectRange("A1:A6");
99
		typeKeys("<alt T O>");
100
		OptionsDlgList.select(15);	// Select "OpenOffice.org Spreadsheets"
101
		typeKeys("<shift =>");	// Expand "OpenOffice.org Spreadsheets" 
102
		OptionsDlgList.select(19);	// Select "Sort Lists"
103
		
104
		// Click "Copy" button, "OK", close the document		
105
		OptionsDlg_Copy.click();
106
		OptionsDlg.ok();
107
		calc.menuItem("File->Close").select();
108
		MsgBox_AdditionalRowsNotSaved.no();
109
		// Dependencies end
110
				
111
		// Create a new spreadsheet document
112
		startcenter.menuItem("File->New->Spreadsheet").select();
113
		sleep(3);
114
		
115
		// Input some data
116
		String[][] data = new String[][] {
117
				{"Color"},
118
				{"black"},
119
				{"yellow"},
120
				{"blue"},
121
				{"black"},
122
				{"white"},
123
				{"red"},
124
		};
125
		String[][] expectedResultNoCustomSortOrder = new String[][] {
126
				{"Color"},
127
				{"black"},
128
				{"black"},
129
				{"blue"},
130
				{"red"},
131
				{"white"},
132
				{"yellow"},
133
		};
134
		String[][] expectedResultCustomSortOrder = new String[][] {
135
				{"Color"},
136
				{"red"},
137
				{"yellow"},
138
				{"blue"},
139
				{"white"},
140
				{"black"},
141
				{"black"},
142
		};
143
		CalcUtil.selectRange("A1");
144
		typeKeys("Color<down>black<down>yellow<down>blue<down>black<down>white<down>red");
145
		CalcUtil.selectRange("A2:A7");
146
		calc.menuItem("Format->Change Case->Lowercase").select();	// In case SC capitalize first letter automatically
147
		
148
		// "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color
149
		CalcUtil.selectRange("A1:A7");
150
		calc.menuItem("Data->Sort...").select();
151
		SortOptionsPage.select();
152
		SortOptionsPage_RangeContainsColumnLabels.check();
153
		SortOptionsPage_CustomSortOrder.uncheck();
154
		SortPage.select();
155
		SortPage_By1.select("Color");
156
		SortPage_Ascending1.check();
157
		SortPage.ok();	
158
		
159
		// Verify sorted result
160
		assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
161
		
162
		// Uodo/redo
163
		calc.menuItem("Edit->Undo: Sort").select();
164
		sleep(1);
165
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
166
		calc.menuItem("Edit->Redo: Sort").select();
167
		sleep(1);
168
		assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
169
		calc.menuItem("Edit->Undo: Sort").select();
170
		
171
		// Copy original data to sheet2
172
		CalcUtil.selectRange("A1:A7");
173
		calc.menuItem("Edit->Copy").select();
174
		CalcUtil.selectRange("Sheet2.A1");
175
		calc.menuItem("Edit->Paste").select();		
176
		sleep(1);
177
		
178
		// "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color
179
		calc.menuItem("Data->Sort...").select();
180
		SortOptionsPage.select();
181
		SortOptionsPage_RangeContainsColumnLabels.check();
182
		SortOptionsPage_CustomSortOrder.check();
183
		SortOptionsPage_CustomSortOrderList.select("red,yellow,blue,green,white,black");
184
		SortPage.select();
185
		SortPage_By1.select("Color");
186
		SortPage_Ascending1.check();
187
		SortPage.ok();	
188
		
189
		// Verify sorted result
190
		assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
191
		
192
		// Uodo/redo
193
		calc.menuItem("Edit->Undo: Sort").select();
194
		sleep(1);
195
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
196
		calc.menuItem("Edit->Redo: Sort").select();
197
		sleep(1);
198
		assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
199
		
200
		// Save and close document
201
		String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromCopyList.ods");
202
		calc.menuItem("File->Save As...").select();
203
		FileUtil.deleteFile(saveTo);
204
		submitSaveDlg(saveTo);	
205
		calc.menuItem("File->Close").select();
206
		openStartcenter();
207
		
208
		// Reopen and verify sorted result
209
		startcenter.menuItem("File->Open...").select();
210
		submitOpenDlg(saveTo);
211
		calc.waitForExistence(10, 2);
212
		assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7"));
213
		assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7"));
214
	}	
215
}
(-)src/testcase/sc/sort/SortOptionsMultipleSortParameterSaved.java (-190 lines)
Lines 1-190 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 SortOptionsMultipleSortParameterSaved{
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: multiple sort, no data overlap, sort parameter saved correctly
73
	 * @throws Exception
74
	 */
75
	@Test
76
	public void testSortOptionsMultipleSortSortParameterSaved() 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[][] data1 = new String[][] {
84
				{"D"},
85
				{"C"},
86
				{"B"},
87
				{"A"},
88
				{"E"},
89
		};
90
		String[][] expectedSortedResult1 = new String[][] {
91
				{"A"},
92
				{"B"},
93
				{"C"},
94
				{"D"},
95
				{"E"},
96
		};
97
		String[][] data2 = new String[][] {
98
				{"Numbers"},
99
				{"4"},
100
				{"2"},
101
				{"5"},
102
				{"1"},
103
				{"3"},
104
		};
105
		String[][] expectedSortedResult2 = new String[][] {
106
				{"Numbers"},
107
				{"1"},
108
				{"2"},
109
				{"3"},
110
				{"4"},
111
				{"5"},
112
		};
113
		CalcUtil.selectRange("A1");
114
		typeKeys("D<down>C<down>B<down>A<down>E");
115
		
116
		// "Data->Sort...", uncheck "Range contains column labels", check "Case sensitive" and "Include formats", sort first by "Column A", "Ascending"
117
		calc.menuItem("Data->Sort...").select();
118
		SortOptionsPage.select();
119
		SortOptionsPage_RangeContainsColumnLabels.uncheck();
120
		SortOptionsPage_CaseSensitive.check();
121
		SortOptionsPage_IncludeFormats.check();
122
		SortPage.select();
123
		SortPage_By1.select("Column A");
124
		SortPage_Ascending1.check();
125
		SortPage.ok();		
126
		
127
		// Verify sorted result
128
		assertArrayEquals("Sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
129
		
130
		// Uodo/redo
131
		calc.menuItem("Edit->Undo: Sort").select();
132
		assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5"));
133
		calc.menuItem("Edit->Redo: Sort").select();
134
		assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
135
		
136
		// Input data2 into same sheet, data1 and data2 are not overlapped
137
		CalcUtil.selectRange("G10");
138
		typeKeys("Numbers<down>4<down>2<down>5<down>1<down>3");
139
		
140
		// Focus on data2, "Data->Sort...", check "Range contains column labels", uncheck "Case sensitive" and "Include formats", sort first by "Numbers", "Ascending"
141
		CalcUtil.selectRange("G10");
142
		calc.menuItem("Data->Sort...").select();
143
		SortOptionsPage.select();
144
		SortOptionsPage_RangeContainsColumnLabels.check();
145
		SortOptionsPage_CaseSensitive.uncheck();
146
		SortOptionsPage_IncludeFormats.uncheck();
147
		SortPage.select();
148
		SortPage_By1.select("Numbers");
149
		SortPage_Ascending1.check();
150
		SortPage.ok();			
151
		
152
		// Verify sorted result
153
		assertArrayEquals("Sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15"));
154
		
155
		// Uodo/redo
156
		calc.menuItem("Edit->Undo: Sort").select();
157
		assertArrayEquals("Undo sorted result", data2, CalcUtil.getCellTexts("G10:G15"));
158
		calc.menuItem("Edit->Redo: Sort").select();
159
		assertArrayEquals("Redo sorted result", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15"));
160
		
161
		// Open sort dialog, check its setting
162
		calc.menuItem("Data->Sort...").select();
163
		SortOptionsPage.select();
164
		assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked());
165
		assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked());
166
		assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked());
167
		SortOptionsPage.ok();		
168
		
169
		// Save and close document
170
		String saveTo = fullPath("temp/" + "SortOptionsMultipleSortParameterSaved.ods");
171
		calc.menuItem("File->Save As...").select();
172
		FileUtil.deleteFile(saveTo);
173
		submitSaveDlg(saveTo);	
174
		calc.menuItem("File->Close").select();
175
		openStartcenter();
176
		
177
		// Reopen and verify sorted result and sort parameters
178
		startcenter.menuItem("File->Open...").select();
179
		submitOpenDlg(saveTo);
180
		calc.waitForExistence(10, 2);
181
		assertArrayEquals("Saved sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
182
		assertArrayEquals("Saved sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15"));
183
		calc.menuItem("Data->Sort...").select();
184
		SortOptionsPage.select();
185
		assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked());
186
		assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked());
187
		assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked());
188
		SortOptionsPage.ok();	
189
	}
190
}
(-)src/testcase/sc/sheet/InsertSheet.java (-6 / +3 lines)
Lines 21-34 Link Here
21
package testcase.sc.sheet;
21
package testcase.sc.sheet;
22
22
23
import static org.junit.Assert.*;
23
import static org.junit.Assert.*;
24
import static org.openoffice.test.vcl.Tester.*;
25
import static testlib.UIMap.*;
24
import static testlib.UIMap.*;
26
27
import org.junit.After;
25
import org.junit.After;
28
import org.junit.Before;
26
import org.junit.Before;
29
import org.junit.Rule;
27
import org.junit.Rule;
30
import org.junit.Test;
28
import org.junit.Test;
31
32
import testlib.Log;
29
import testlib.Log;
33
30
34
/**
31
/**
Lines 41-47 Link Here
41
38
42
	@Rule
39
	@Rule
43
	public Log LOG = new Log();
40
	public Log LOG = new Log();
44
	
41
45
	@Before
42
	@Before
46
	public void setUp() throws Exception {
43
	public void setUp() throws Exception {
47
		app.start();
44
		app.start();
Lines 53-59 Link Here
53
	public void tearDown() throws Exception {
50
	public void tearDown() throws Exception {
54
		app.close();
51
		app.close();
55
	}
52
	}
56
	
53
57
	/**
54
	/**
58
	 * Insert one sheet in different place
55
	 * Insert one sheet in different place
59
	 * @throws Exception
56
	 * @throws Exception
Lines 71-77 Link Here
71
		assertArrayEquals(new String[] { "Sheet4", "Sheet5", "Sheet6", "Sheet1", "Sheet2", "Sheet3" }, SCSheetsList.getItemsText());
68
		assertArrayEquals(new String[] { "Sheet4", "Sheet5", "Sheet6", "Sheet1", "Sheet2", "Sheet3" }, SCSheetsList.getItemsText());
72
		SCSelectSheetsDlg.ok();
69
		SCSelectSheetsDlg.ok();
73
	}
70
	}
74
	
71
75
	/**
72
	/**
76
	 * Insert one sheet in different place
73
	 * Insert one sheet in different place
77
	 * @throws Exception
74
	 * @throws Exception
(-)src/testcase/sc/chart/ChartWizardTitle.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
/**
25
 * 
26
 */
27
package testcase.sc.chart;
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
 */
53
public class ChartWizardTitle {
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 Chart Wizard dialog title words
75
	 */
76
	@Test
77
	public void test() {
78
		// Create a new text document
79
		startcenter.menuItem("File->New->Spreadsheet").select();
80
		sleep(3);
81
		calc.menuItem("Insert->Chart...").select();
82
		assertEquals("Chart Wizard",Chart_Wizard.getText());
83
		Chart_Wizard.cancel();
84
	}
85
86
}
(-)src/testcase/sc/validity/NotLockCellFromValidityCell.java (-82 lines)
Lines 1-82 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 NotLockCellFromValidityCell {
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 Cell is not locked after switch from validity cell to source cells
66
	 */
67
	@Test
68
	public void testNotLockCellFromValidityCell() {
69
		//open sample file on data path
70
		String file = testFile("sc/sampledata.ods");
71
		startcenter.menuItem("File->Open").select();
72
		submitOpenDlg(file);
73
		
74
		CalcUtil.selectRange("Sheet1.F19");
75
		typeKeys("d"+"<enter>");
76
		CalcUtil.selectRange("Sheet1.F17");
77
		typeKeys("Test"+"<enter>");
78
		
79
		assertEquals("Test",CalcUtil.getCellText("F17"));
80
	}
81
82
}
(-)src/testcase/sc/sort/SortOptionsIncludeFormats.java (-222 lines)
Lines 1-222 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 SortOptionsIncludeFormats {
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: "Include formats"
73
	 * @throws Exception
74
	 */
75
	@Test
76
	public void testSortOptionsIncludeFormats() 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"},
85
//				{"32"},
86
//				{"57"},
87
//				{"74"},
88
//				{"50"},
89
//				{"27"},
90
//				{"7"},
91
//		};
92
		String[][] dataWithCurrencyFormats = new String[][] {
93
				{"Units"},
94
				{"$32.00"},
95
				{"57.00 \u20ac"},
96
				{"\u20a4 74"},
97
				{"R$ 50.00"},
98
				{"\u062c.\u0645. 27.00"},
99
				{"7.00 \u0440\u0443\u0431."},
100
		};
101
		String[][] expectedSortedResultIncludeFormat = new String[][] {
102
				{"Units"},
103
				{"7.00 \u0440\u0443\u0431."},
104
				{"\u062c.\u0645. 27.00"},
105
				{"$32.00"},
106
				{"R$ 50.00"},
107
				{"57.00 \u20ac"},
108
				{"\u20a4 74"},
109
		};
110
		String[][] expectedSortedResultExcludeFormat = new String[][] {
111
				{"Units"},
112
				{"$7.00"},
113
				{"27.00 \u20ac"},
114
				{"\u20a4 32"},
115
				{"R$ 50.00"},
116
				{"\u062c.\u0645. 57.00"},
117
				{"74.00 \u0440\u0443\u0431."},
118
		};
119
		CalcUtil.selectRange("A1");
120
		typeKeys("Units<down>32<down>57<down>74<down>50<down>27<down>7");
121
		
122
		// Set Currency formats
123
		CalcUtil.selectRange("A2");
124
		typeKeys("<ctrl 1>");
125
//		calc.menuItem("Fortmat->Cells...").select(); error: can not find item "Format"
126
		FormatCellsDlg_NumbersPage.select();
127
		FormatCellsDlg_NumbersPageCategory.select("Currency");
128
		FormatCellsDlg_NumbersPageCurrencyFormat.select("$ English (USA)");
129
		FormatCellsDlg_NumbersPage.ok();
130
		CalcUtil.selectRange("A3");
131
		typeKeys("<ctrl 1>");
132
		FormatCellsDlg_NumbersPage.select();
133
		FormatCellsDlg_NumbersPageCategory.select("Currency");
134
		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20ac Spanish (Spain)");
135
		FormatCellsDlg_NumbersPage.ok();
136
		CalcUtil.selectRange("A4");
137
		typeKeys("<ctrl 1>");
138
		FormatCellsDlg_NumbersPage.select();
139
		FormatCellsDlg_NumbersPageCategory.select("Currency");
140
		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20a4 Latin");
141
		FormatCellsDlg_NumbersPage.ok();		
142
		CalcUtil.selectRange("A5");
143
		typeKeys("<ctrl 1>");
144
		FormatCellsDlg_NumbersPage.select();
145
		FormatCellsDlg_NumbersPageCategory.select("Currency");
146
		FormatCellsDlg_NumbersPageCurrencyFormat.select("R$ Portuguese (Brazil)");
147
		FormatCellsDlg_NumbersPage.ok();	
148
		CalcUtil.selectRange("A6");
149
		typeKeys("<ctrl 1>");
150
		FormatCellsDlg_NumbersPage.select();
151
		FormatCellsDlg_NumbersPageCategory.select("Currency");
152
		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u062c.\u0645. Arabic (Egypt)");
153
		FormatCellsDlg_NumbersPage.ok();	
154
		CalcUtil.selectRange("A7");
155
		typeKeys("<ctrl 1>");
156
		FormatCellsDlg_NumbersPage.select();
157
		FormatCellsDlg_NumbersPageCategory.select("Currency");
158
		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u0440\u0443\u0431. Russian");
159
		FormatCellsDlg_NumbersPage.ok();	
160
		
161
		// "Data->Sort...", check "Range contains column labels", check "Include formats", sort first by "Units", "Ascending"
162
		calc.menuItem("Data->Sort...").select();
163
		SortOptionsPage.select();
164
		SortOptionsPage_RangeContainsColumnLabels.check();
165
		SortOptionsPage_IncludeFormats.check();
166
		SortPage.select();
167
		SortPage_By1.select("Units");
168
		SortPage_Ascending1.check();
169
		SortPage.ok();		
170
		
171
		// Verify sorted result
172
		assertArrayEquals("Sorted result include formats", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7"));
173
		
174
		// Uodo/redo
175
		calc.menuItem("Edit->Undo: Sort").select();
176
		assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7"));
177
		calc.menuItem("Edit->Redo: Sort").select();
178
		assertArrayEquals("Redo sorted result", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7"));
179
		calc.menuItem("Edit->Undo: Sort").select();
180
		
181
		// Copy the original data to sheet2
182
		CalcUtil.selectRange("A1:A7");
183
		calc.menuItem("Edit->Copy").select();
184
		CalcUtil.selectRange("Sheet2.A1");
185
		calc.menuItem("Edit->Paste").select();		
186
		sleep(1);
187
		
188
		// "Data->Sort...", check "Range contains column labels", uncheck "Include formats", sort first by "Units", "Ascending"
189
		calc.menuItem("Data->Sort...").select();
190
		SortOptionsPage.select();
191
		SortOptionsPage_RangeContainsColumnLabels.check();
192
		SortOptionsPage_IncludeFormats.uncheck();
193
		SortPage.select();
194
		SortPage_By1.select("Units");
195
		SortPage_Ascending1.check();
196
		SortPage.ok();		
197
		
198
		// Verify sorted result
199
		assertArrayEquals("Sorted result exclude formats", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7"));	
200
		
201
		// Uodo/redo
202
		calc.menuItem("Edit->Undo: Sort").select();
203
		assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7"));
204
		calc.menuItem("Edit->Redo: Sort").select();
205
		assertArrayEquals("Redo sorted result", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7"));
206
		
207
		// Save and close document
208
		String saveTo = fullPath("temp/" + "SortOptionsIncludeFormats.ods");
209
		calc.menuItem("File->Save As...").select();
210
		FileUtil.deleteFile(saveTo);
211
		submitSaveDlg(saveTo);	
212
		calc.menuItem("File->Close").select();
213
		openStartcenter();
214
		
215
		// Reopen and verify sorted result
216
		startcenter.menuItem("File->Open...").select();
217
		submitOpenDlg(saveTo);
218
		calc.waitForExistence(10, 2);
219
		assertArrayEquals("Original data", dataWithCurrencyFormats, CalcUtil.getCellTexts("$Sheet1.$A1:$A7"));
220
		assertArrayEquals("Saved sorted result exclude format", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("$Sheet2.$A1:$A7"));
221
	}
222
}
(-)src/testcase/sd/headerandfooter/OpenDocumentWithHeaderFooter.java (-1 / +1 lines)
Lines 24-30 Link Here
24
/**
24
/**
25
 * 
25
 * 
26
 */
26
 */
27
package testcase.presentation.headerandfooter;
27
package testcase.sd.headerandfooter;
28
28
29
import static testlib.AppUtil.fullPath;
29
import static testlib.AppUtil.fullPath;
30
import static testlib.AppUtil.openStartcenter;
30
import static testlib.AppUtil.openStartcenter;
(-)src/testcase/sc/sort/SortCriteriaSortThirdBy.java (-211 lines)
Lines 1-211 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 SortCriteriaSortThirdBy {
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 third by
73
	 * @throws Exception
74
	 */
75
	@Test
76
	public void testSortCriteriaSortThirdBy() 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", "AB", "2"},
85
				{"8", "FLK", "5"},
86
				{"6", "E", "4"},
87
				{"1", "AB", "1"},
88
				{"9", "GE", "6"},
89
				{"2", "AB", "2"},
90
				{"7", "EFYU", "7"},
91
				{"5", "DS", "8"},
92
				{"4", "AB", "1"},
93
		};
94
		String[][] expectedResultSortFirstByB = new String[][] {
95
				{"3", "AB", "2"},
96
				{"1", "AB", "1"},
97
				{"2", "AB", "2"},
98
				{"4", "AB", "1"},
99
				{"5", "DS", "8"},
100
				{"6", "E", "4"},
101
				{"7", "EFYU", "7"},
102
				{"8", "FLK", "5"},
103
				{"9", "GE", "6"},
104
		};
105
		String[][] expectedResultSortSecondByC= new String[][] {
106
				{"3", "AB", "2"},
107
				{"2", "AB", "2"},
108
				{"1", "AB", "1"},
109
				{"4", "AB", "1"},
110
				{"5", "DS", "8"},
111
				{"6", "E", "4"},
112
				{"7", "EFYU", "7"},
113
				{"8", "FLK", "5"},
114
				{"9", "GE", "6"},
115
		};
116
		String[][] expectedResultSortThirdByA= new String[][] {
117
				{"3", "AB", "2"},
118
				{"2", "AB", "2"},
119
				{"4", "AB", "1"},
120
				{"1", "AB", "1"},
121
				{"5", "DS", "8"},
122
				{"6", "E", "4"},
123
				{"7", "EFYU", "7"},
124
				{"8", "FLK", "5"},
125
				{"9", "GE", "6"},
126
		};
127
		CalcUtil.selectRange("A1");
128
		typeKeys("3<down>8<down>6<down>1<down>9<down>2<down>7<down>5<down>4");
129
		CalcUtil.selectRange("B1");
130
		typeKeys("AB<down>FLK<down>E<down>AB<down>GE<down>AB<down>EFYU<down>DS<down>AB");
131
		CalcUtil.selectRange("C1");
132
		typeKeys("2<down>5<down>4<down>1<down>6<down>2<down>7<down>8<down>1");
133
		sleep(0.5);
134
		
135
		// "Data->Sort...", choose "Ascending", sort first by Column B
136
		calc.menuItem("Data->Sort...").select();
137
		SortPage_By1.select("Column B");
138
		SortPage_Ascending1.check();
139
		SortPage.ok();
140
		
141
		// Verify sorted result
142
		assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9"));
143
		
144
		// Uodo/redo
145
		calc.menuItem("Edit->Undo: Sort").select();
146
		sleep(1);
147
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:C9"));
148
		calc.menuItem("Edit->Redo: Sort").select();
149
		sleep(1);
150
		assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9"));
151
		calc.menuItem("Edit->Undo: Sort").select();
152
		sleep(1);
153
		
154
		// Save and close document
155
		String saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy.ods");
156
		calc.menuItem("File->Save As...").select();
157
		FileUtil.deleteFile(saveTo);
158
		submitSaveDlg(saveTo);	
159
		calc.menuItem("File->Close").select();
160
		openStartcenter();
161
		
162
		// Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending"
163
		startcenter.menuItem("File->Open...").select();
164
		submitOpenDlg(saveTo);
165
		calc.waitForExistence(10, 2);
166
		calc.menuItem("Data->Sort...").select();
167
		SortPage_By1.select("Column B");
168
		SortPage_Ascending1.check();
169
		SortPage_By2.select("Column C");
170
		SortPage_Descending2.check();
171
		SortPage.ok();
172
173
		// Verify sorted result
174
		assertArrayEquals("Sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9"));
175
		
176
		// "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending", sort third by Column A "Descending"
177
		calc.menuItem("Data->Sort...").select();
178
		SortPage_By1.select("Column B");
179
		SortPage_Ascending1.check();
180
		SortPage_By2.select("Column C");
181
		SortPage_Descending2.check();
182
		SortPage_By3.select("Column A");
183
		SortPage_Descending3.check();
184
		SortPage.ok();
185
186
		// Verify sorted result
187
		assertArrayEquals("Sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9"));	
188
		
189
		// Uodo/redo
190
		calc.menuItem("Edit->Undo: Sort").select();
191
		sleep(1);
192
		assertArrayEquals("Undo sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9"));
193
		calc.menuItem("Edit->Redo: Sort").select();
194
		sleep(1);
195
		assertArrayEquals("Redo sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9"));
196
		
197
		// Save and close document
198
		saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy1.ods");
199
		calc.menuItem("File->Save As...").select();
200
		FileUtil.deleteFile(saveTo);
201
		submitSaveDlg(saveTo);	
202
		calc.menuItem("File->Close").select();
203
		openStartcenter();
204
		
205
		// Reopen and verify data sort is not lost
206
		startcenter.menuItem("File->Open...").select();
207
		submitOpenDlg(saveTo);
208
		calc.waitForExistence(10, 2);
209
		assertArrayEquals("Saved sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9"));	
210
	}	
211
}
(-)src/testcase/sc/celltext/InsertRowsFromMainMenu.java (-117 lines)
Lines 1-117 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.celltext;
25
import static testlib.AppUtil.*;
26
import static testlib.UIMap.*;
27
28
import java.awt.Rectangle;
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.Ignore;
37
import org.junit.Rule;
38
import org.junit.Test;
39
import org.openoffice.test.common.FileUtil;
40
import org.openoffice.test.common.GraphicsUtil;
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
public class InsertRowsFromMainMenu {
46
47
	/**
48
	 * TestCapture helps us to do
49
	 * 1. Take a screenshot when failure occurs.
50
	 * 2. Collect extra data when OpenOffice crashes.
51
	 */	
52
	@Rule
53
	public Log LOG = new Log();
54
	
55
	/**
56
	 * initApp helps us to do 
57
	 * 1. Patch the OpenOffice to enable automation if necessary.
58
	 * 2. Start OpenOffice with automation enabled if necessary.
59
	 * 3. Reset OpenOffice to startcenter.
60
	 * 
61
	 * @throws java.lang.Exception
62
	 */
63
	@Before
64
	public void setUp() throws Exception {
65
		initApp();
66
	}
67
	/**
68
	 * Insert rows from main menu.
69
	 * 
70
	 * @throws Exception
71
	 */
72
	@Test
73
	public void insertRowsFromMainMenu(){
74
		//Create a new text document
75
		startcenter.menuItem("File->New->Spreadsheet").select();
76
		sleep(3);
77
		//input 1 into cell A1
78
		String expect = "Test123";
79
		CalcUtil.selectRange("A1");
80
		typeKeys(expect + "<enter>");
81
		CalcUtil.selectRange("A1");
82
		// Insert 1 columns before column A form main menu,so Cell A1 move A2, check it
83
		calc.menuItem("Insert->Rows...").select();
84
		assertEquals("1",SC_NumberOfColumnsRowsToInsert.getText());
85
		SC_InsertColumnsRowsdialog.ok();
86
		sleep(1);
87
		assertEquals(expect, CalcUtil.getCellText("A2"));
88
		//input Test123 into A5, select first 4 rows, in insert dialog, the defaul row should be 4, check it
89
		CalcUtil.selectRange("A5");
90
		typeKeys(expect + "<enter>");
91
		CalcUtil.selectRange("A1:A4");
92
		calc.menuItem("Insert->Rows...").select();
93
		assertEquals("4",SC_NumberOfColumnsRowsToInsert.getText());
94
		
95
		//After insert 4 rows after the selected rows, the A5 move to A9, check it
96
		SC_InsertColumnsRowsAfterSelectColumn.check();
97
		assertTrue(SC_InsertColumnsRowsAfterSelectColumn.isEnabled());
98
		SC_InsertColumnsRowsdialog.ok();
99
		sleep(1);
100
		assertEquals(expect,CalcUtil.getCellText("A9"));
101
		
102
		//Input some value into 1048576
103
		CalcUtil.selectRange("A1048576");
104
		typeKeys("1048576<enter>");
105
		assertEquals("1048576",CalcUtil.getCellText("A1048576"));
106
		// Select many rows input 65536 in insert Rows number, verify the warning message, check it
107
		CalcUtil.selectRange("A1:A50000");
108
		sleep(1);
109
		calc.menuItem("Insert->Rows...").select();
110
		SC_NumberOfColumnsRowsToInsert.setText("65536");
111
		SC_InsertColumnsRowsdialog.ok();
112
		assertEquals("Filled cells cannot be shifted" + "\n"
113
				+ "beyond the sheet.",
114
				ActiveMsgBox.getMessage());
115
		typeKeys("<enter>");
116
	}
117
}
(-)src/testcase/sc/filter/AutoFilterSortAscendingMutiColumns.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.filter;
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 AutoFilterSortAscendingMutiColumns {
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 Auto Filter sort ascending in muti-columns
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("sc/sample_topN3.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
82
		CalcUtil.selectRange("A1:E200");
83
		calc.menuItem("Data->Filter->AutoFilter").select();
84
		SpreadSheetCells.click(72, 8);
85
		typeKeys("<up>");
86
		typeKeys("<up>");
87
		typeKeys("<enter>");
88
		assertEquals("A",CalcUtil.getCellText("A1"));
89
		assertEquals("B",CalcUtil.getCellText("B1"));
90
		assertEquals("C",CalcUtil.getCellText("C1"));
91
		assertEquals("D",CalcUtil.getCellText("D1"));
92
		assertEquals("E",CalcUtil.getCellText("E1"));
93
		assertEquals("Item1",CalcUtil.getCellText("A2"));
94
		assertEquals("5",CalcUtil.getCellText("B2"));
95
		assertEquals("246",CalcUtil.getCellText("C2"));
96
		assertEquals("0",CalcUtil.getCellText("D2"));
97
		assertEquals("24",CalcUtil.getCellText("E2"));
98
		assertEquals("Item52",CalcUtil.getCellText("A200"));
99
		assertEquals("52",CalcUtil.getCellText("B200"));
100
		assertEquals("199",CalcUtil.getCellText("C200"));
101
		assertEquals("5",CalcUtil.getCellText("D200"));
102
		assertEquals("19",CalcUtil.getCellText("E200"));
103
		assertEquals("Item99",CalcUtil.getCellText("A251"));
104
		assertEquals("99",CalcUtil.getCellText("B251"));
105
		assertEquals("152",CalcUtil.getCellText("C251"));
106
		assertEquals("9",CalcUtil.getCellText("D251"));
107
		assertEquals("15",CalcUtil.getCellText("E251"));
108
109
		CalcUtil.selectRange("A1");
110
		SpreadSheetCells.click(152, 8);
111
		typeKeys("<up>");
112
		typeKeys("<up>");
113
		typeKeys("<enter>");
114
		assertEquals("A",CalcUtil.getCellText("A1"));
115
		assertEquals("B",CalcUtil.getCellText("B1"));
116
		assertEquals("C",CalcUtil.getCellText("C1"));
117
		assertEquals("D",CalcUtil.getCellText("D1"));
118
		assertEquals("E",CalcUtil.getCellText("E1"));
119
		assertEquals("Item1",CalcUtil.getCellText("A2"));
120
		assertEquals("5",CalcUtil.getCellText("B2"));
121
		assertEquals("246",CalcUtil.getCellText("C2"));
122
		assertEquals("0",CalcUtil.getCellText("D2"));
123
		assertEquals("24",CalcUtil.getCellText("E2"));
124
		assertEquals("Item199",CalcUtil.getCellText("A200"));
125
		assertEquals("199",CalcUtil.getCellText("B200"));
126
		assertEquals("52",CalcUtil.getCellText("C200"));
127
		assertEquals("19",CalcUtil.getCellText("D200"));
128
		assertEquals("5",CalcUtil.getCellText("E200"));
129
		assertEquals("Item250",CalcUtil.getCellText("A251"));
130
		assertEquals("250",CalcUtil.getCellText("B251"));
131
		assertEquals("1",CalcUtil.getCellText("C251"));
132
		assertEquals("25",CalcUtil.getCellText("D251"));
133
		assertEquals("0",CalcUtil.getCellText("E251"));
134
		
135
		
136
		CalcUtil.selectRange("A1");
137
		SpreadSheetCells.click(72, 8);
138
		typeKeys("<up>");
139
		typeKeys("<enter>");
140
		assertEquals("A",CalcUtil.getCellText("A1"));
141
		assertEquals("B",CalcUtil.getCellText("B1"));
142
		assertEquals("C",CalcUtil.getCellText("C1"));
143
		assertEquals("D",CalcUtil.getCellText("D1"));
144
		assertEquals("E",CalcUtil.getCellText("E1"));
145
		assertEquals("Item99",CalcUtil.getCellText("A2"));
146
		assertEquals("99",CalcUtil.getCellText("B2"));
147
		assertEquals("152",CalcUtil.getCellText("C2"));
148
		assertEquals("9",CalcUtil.getCellText("D2"));
149
		assertEquals("15",CalcUtil.getCellText("E2"));
150
		assertEquals("Item145",CalcUtil.getCellText("A200"));
151
		assertEquals("145",CalcUtil.getCellText("B200"));
152
		assertEquals("106",CalcUtil.getCellText("C200"));
153
		assertEquals("14",CalcUtil.getCellText("D200"));
154
		assertEquals("10",CalcUtil.getCellText("E200"));
155
		assertEquals("Item1",CalcUtil.getCellText("A251"));
156
		assertEquals("5",CalcUtil.getCellText("B251"));
157
		assertEquals("246",CalcUtil.getCellText("C251"));
158
		assertEquals("0",CalcUtil.getCellText("D251"));
159
		assertEquals("24",CalcUtil.getCellText("E251"));
160
		
161
		CalcUtil.selectRange("A1");
162
		SpreadSheetCells.click(232, 8);
163
		typeKeys("<up>");
164
		typeKeys("<enter>");
165
		assertEquals("A",CalcUtil.getCellText("A1"));
166
		assertEquals("B",CalcUtil.getCellText("B1"));
167
		assertEquals("C",CalcUtil.getCellText("C1"));
168
		assertEquals("D",CalcUtil.getCellText("D1"));
169
		assertEquals("E",CalcUtil.getCellText("E1"));
170
		assertEquals("Item9",CalcUtil.getCellText("A2"));
171
		assertEquals("5",CalcUtil.getCellText("B2"));
172
		assertEquals("246",CalcUtil.getCellText("C2"));
173
		assertEquals("0",CalcUtil.getCellText("D2"));
174
		assertEquals("24",CalcUtil.getCellText("E2"));
175
		assertEquals("Item199",CalcUtil.getCellText("A200"));
176
		assertEquals("199",CalcUtil.getCellText("B200"));
177
		assertEquals("52",CalcUtil.getCellText("C200"));
178
		assertEquals("19",CalcUtil.getCellText("D200"));
179
		assertEquals("5",CalcUtil.getCellText("E200"));
180
		assertEquals("Item250",CalcUtil.getCellText("A251"));
181
		assertEquals("250",CalcUtil.getCellText("B251"));
182
		assertEquals("1",CalcUtil.getCellText("C251"));
183
		assertEquals("25",CalcUtil.getCellText("D251"));
184
		assertEquals("0",CalcUtil.getCellText("E251"));
185
		
186
187
		CalcUtil.selectRange("A1");
188
		SpreadSheetCells.click(312, 8);
189
		typeKeys("<up>");
190
		typeKeys("<up>");
191
		typeKeys("<enter>");
192
		assertEquals("A",CalcUtil.getCellText("A1"));
193
		assertEquals("B",CalcUtil.getCellText("B1"));
194
		assertEquals("C",CalcUtil.getCellText("C1"));
195
		assertEquals("D",CalcUtil.getCellText("D1"));
196
		assertEquals("E",CalcUtil.getCellText("E1"));
197
		assertEquals("Item9",CalcUtil.getCellText("A2"));
198
		assertEquals("5",CalcUtil.getCellText("B2"));
199
		assertEquals("246",CalcUtil.getCellText("C2"));
200
		assertEquals("0",CalcUtil.getCellText("D2"));
201
		assertEquals("24",CalcUtil.getCellText("E2"));
202
		assertEquals("Item199",CalcUtil.getCellText("A200"));
203
		assertEquals("199",CalcUtil.getCellText("B200"));
204
		assertEquals("52",CalcUtil.getCellText("C200"));
205
		assertEquals("19",CalcUtil.getCellText("D200"));
206
		assertEquals("5",CalcUtil.getCellText("E200"));
207
		assertEquals("Item250",CalcUtil.getCellText("A251"));
208
		assertEquals("250",CalcUtil.getCellText("B251"));
209
		assertEquals("1",CalcUtil.getCellText("C251"));
210
		assertEquals("25",CalcUtil.getCellText("D251"));
211
		assertEquals("0",CalcUtil.getCellText("E251"));
212
	}
213
214
}
(-)src/testcase/sc/validity/ValidityDialogDefaultValue.java (-29 / +33 lines)
Lines 23-75 Link Here
23
23
24
package testcase.sc.validity;
24
package testcase.sc.validity;
25
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
26
import static testlib.UIMap.*;
28
29
import org.junit.After;
27
import org.junit.After;
30
import static org.junit.Assert.*;
28
import static org.junit.Assert.*;
31
import static org.openoffice.test.vcl.Tester.*;
32
33
import org.junit.Before;
29
import org.junit.Before;
34
import org.junit.Rule;
30
import org.junit.Rule;
35
import org.junit.Test;
31
import org.junit.Test;
32
import testlib.Log;
36
33
37
34
38
import testlib.CalcUtil;
35
public class ValidityDialogDefaultValue {
39
import testlib.Log;
40
36
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
37
	@Rule
49
	public Log LOG = new Log();
38
	public Log LOG = new Log();
50
	
39
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
40
	@Before
60
	public void setUp() throws Exception {
41
	public void setUp() throws Exception {
61
		initApp();
42
		app.start();
43
44
		// New a spreadsheet, open Validity dialog
45
		startcenter.menuItem("File->New->Spreadsheet").select();
46
		calc.menuItem("Data->Validity...").select();
62
	}
47
	}
63
	
48
49
	@After
50
	public void tearDown() throws Exception {
51
		app.close();
52
	}
53
64
	/**
54
	/**
55
	 * test Data -> Validity - UI(Criteria: Cell range).
56
	 */
57
	@Test
58
	public void testValidityUICellRange() {
59
60
		SC_ValidityCriteriaTabpage.select();
61
		SC_ValidityCriteriaAllowList.select("Cell range");
62
63
		assertEquals(true,SC_ValidityAllowBlankCells.isChecked());
64
		assertEquals(true,SC_ValidityShowSelectionList.isChecked());
65
		assertEquals(false,SC_ValiditySortEntriesAscending.isChecked());
66
		assertEquals(true,SC_ValidityAllowBlankCells.isEnabled());
67
		assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled());
68
		assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled());
69
		assertEquals(true,SC_ValiditySourcePicker.isEnabled());
70
	}
71
72
	/**
65
	 * test Data -> Validity - UI(Error Alert: Default status)
73
	 * test Data -> Validity - UI(Error Alert: Default status)
66
	 */
74
	 */
67
	@Test
75
	@Test
68
	public void testValidityUIErrorAlert() {
76
	public void testValidityUIErrorAlert() {
69
		startcenter.menuItem("File->New->Spreadsheet").select();
77
70
		sleep(1);
71
		calc.menuItem("Data->Validity...").select();
72
		sleep(1);
73
		SC_ValidityErrorAlertTabPage.select();
78
		SC_ValidityErrorAlertTabPage.select();
74
		assertEquals(true,SC_ValidityErrorAlertActionList.isEnabled());
79
		assertEquals(true,SC_ValidityErrorAlertActionList.isEnabled());
75
		assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText());
80
		assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText());
Lines 79-85 Link Here
79
		assertEquals("",SC_ValidityErrorMessage.getText());
84
		assertEquals("",SC_ValidityErrorMessage.getText());
80
		SC_ValidityErrorAlertActionList.select("Macro");
85
		SC_ValidityErrorAlertActionList.select("Macro");
81
		assertEquals(true,SC_ValidityErrorBrowseButton.isEnabled());
86
		assertEquals(true,SC_ValidityErrorBrowseButton.isEnabled());
82
		
83
	}
87
	}
84
88
85
}
89
}
(-)src/testcase/sc/datapilot/MoveTableNarrowSpaceToShowTheTable.java (-144 lines)
Lines 1-144 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 MoveTableNarrowSpaceToShowTheTable {
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 will be synchronized with table while move table.
75
	 * After the field name get changed, when you refresh the data, the DataPilot table will change to empty table
76
	 * if you create table small than the empty table, the table size will get larger
77
	 * if there is another DataPilot table exist in the larger range, there will pop a warning.
78
	 */
79
	@Test
80
	public void test() {
81
		String file = testFile("source_data01.ods");
82
		startcenter.menuItem("File->Open...").select();
83
		submitOpenDlg(file);
84
		sleep(2);
85
		CalcUtil.selectRange("A1:E27");
86
		calc.menuItem("Data->DataPilot->Start...").select();
87
		CreateDataPilotTableDialog.ok();
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
		
96
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
97
			DataPilotAutomaticallyUpdateCheckBox.check();
98
		}
99
		
100
		DataPilotFieldSelect.click(1, 1);
101
		DataPilotFieldSelect.openContextMenu();
102
		menuItem("Add to Page").select();
103
		assertEquals("Locale",CalcUtil.getCellText("A1"));
104
		sleep(1);
105
		
106
		CalcUtil.selectRange("A1:B4");
107
		typeKeys("<$copy>");
108
		CalcUtil.selectRange("C1");
109
		typeKeys("<$paste>");
110
		sleep(1);
111
		
112
		CalcUtil.selectRange("$A.A1");
113
		typeKeys("New Locale" + "<enter>");
114
		
115
		CalcUtil.selectRange("$DataPilot_A_1.A1");
116
		SpreadSheetCells.openContextMenu();
117
		menuItem("Refresh Data").select();
118
		ActiveMsgBox.ok();
119
		
120
		CalcUtil.selectRange("A1:B4");
121
		SpreadSheetCells.drag(80, 45, 80, 350);
122
		
123
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B20"));
124
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B22"));
125
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B23"));
126
		assertEquals("Page Area",CalcUtil.getCellText("B25"));
127
		assertEquals("Row Area",CalcUtil.getCellText("B28"));
128
		assertEquals("Column Area",CalcUtil.getCellText("D27"));
129
		assertEquals("Data Area",CalcUtil.getCellText("D29"));
130
		DataPilotPanel.close();
131
		sleep(1);
132
		
133
		CalcUtil.selectRange("C1:D4");
134
		SpreadSheetCells.drag(210, 50, 10, 50);
135
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
136
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
137
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
138
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
139
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
140
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
141
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
142
	}
143
144
}
(-)src/testcase/sc/filter/AutoFitlerWithPlusSign.java (-87 lines)
Lines 1-87 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.filter;
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
 */
53
public class AutoFitlerWithPlusSign {
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 Chart Wizard dialog title words
75
	 */
76
	@Test
77
	public void test() {
78
		// Create a new text document
79
		startcenter.menuItem("File->New->Spreadsheet").select();
80
		sleep(3);
81
		String expect ="2+";
82
		CalcUtil.selectRange("A1");
83
		typeKeys(expect + "<enter>");
84
		assertEquals(expect,CalcUtil.getCellText("A1"));
85
	}
86
87
}

Return to issue 120321