1b164ae3eSLei De Bin /**************************************************************
2b164ae3eSLei De Bin  *
3b164ae3eSLei De Bin  * Licensed to the Apache Software Foundation (ASF) under one
4b164ae3eSLei De Bin  * or more contributor license agreements.  See the NOTICE file
5b164ae3eSLei De Bin  * distributed with this work for additional information
6b164ae3eSLei De Bin  * regarding copyright ownership.  The ASF licenses this file
7b164ae3eSLei De Bin  * to you under the Apache License, Version 2.0 (the
8b164ae3eSLei De Bin  * "License"); you may not use this file except in compliance
9b164ae3eSLei De Bin  * with the License.  You may obtain a copy of the License at
10b164ae3eSLei De Bin  *
11b164ae3eSLei De Bin  *   http://www.apache.org/licenses/LICENSE-2.0
12b164ae3eSLei De Bin  *
13b164ae3eSLei De Bin  * Unless required by applicable law or agreed to in writing,
14b164ae3eSLei De Bin  * software distributed under the License is distributed on an
15b164ae3eSLei De Bin  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b164ae3eSLei De Bin  * KIND, either express or implied.  See the License for the
17b164ae3eSLei De Bin  * specific language governing permissions and limitations
18b164ae3eSLei De Bin  * under the License.
19b164ae3eSLei De Bin  *
20b164ae3eSLei De Bin  *************************************************************/
21b164ae3eSLei De Bin 
22faa4b864SLei De Bin /**
23faa4b864SLei De Bin  *
24faa4b864SLei De Bin  */
2580a6f5c5SLiu Zhe package bvt.gui;
2632c31156SLiu Zhe 
2722a14f28SLiu Zhe import static org.junit.Assert.*;
2822a14f28SLiu Zhe import static org.openoffice.test.common.Testspace.*;
2922a14f28SLiu Zhe import static org.openoffice.test.vcl.Tester.*;
30b4d2d410SLiu Zhe import static testlib.gui.AppTool.*;
3122a14f28SLiu Zhe import static testlib.gui.UIMap.*;
32faa4b864SLei De Bin 
33faa4b864SLei De Bin import java.awt.Rectangle;
3491745ed9SLiu Zhe import java.io.File;
35faa4b864SLei De Bin 
3691745ed9SLiu Zhe import org.junit.AfterClass;
37faa4b864SLei De Bin import org.junit.Before;
38b4d2d410SLiu Zhe import org.junit.BeforeClass;
39faa4b864SLei De Bin import org.junit.Rule;
40faa4b864SLei De Bin import org.junit.Test;
41faa4b864SLei De Bin import org.openoffice.test.common.FileUtil;
42faa4b864SLei De Bin import org.openoffice.test.common.GraphicsUtil;
4322a14f28SLiu Zhe import org.openoffice.test.common.Logger;
44faa4b864SLei De Bin 
45b4d2d410SLiu Zhe import testlib.gui.SCTool;
46faa4b864SLei De Bin 
47faa4b864SLei De Bin /**
48faa4b864SLei De Bin  *
49faa4b864SLei De Bin  */
5009c344eeSLiu Zhe public class BasicFunctionTest {
51faa4b864SLei De Bin 
52faa4b864SLei De Bin 	@Rule
5322a14f28SLiu Zhe 	public Logger log = Logger.getLogger(this);
5432c31156SLiu Zhe 
55b4d2d410SLiu Zhe 	@BeforeClass
56*9edf8282SLiu Zhe 	public static void beforeClass() {
57b4d2d410SLiu Zhe 		app.clean();
582fc12ec5SLiu Zhe 	}
592fc12ec5SLiu Zhe 
6091745ed9SLiu Zhe 	@AfterClass
61*9edf8282SLiu Zhe 	public static void afterClass() {
62*9edf8282SLiu Zhe 		app.stop();
6391745ed9SLiu Zhe 	}
6491745ed9SLiu Zhe 
65b4d2d410SLiu Zhe 	@Before
66b4d2d410SLiu Zhe 	public void before() {
67*9edf8282SLiu Zhe 		app.stop();
68b4d2d410SLiu Zhe 		app.start();
69faa4b864SLei De Bin 	}
70*9edf8282SLiu Zhe 
7132c31156SLiu Zhe 
7291745ed9SLiu Zhe 	@Test
7391745ed9SLiu Zhe 	public void smokeTest() {
7491745ed9SLiu Zhe 		File smoketestOutput = new File(aoo.getUserInstallation(), "user/temp");
7591745ed9SLiu Zhe 		prepareData("TestExtension.oxt");
7691745ed9SLiu Zhe 		// Open sample file smoketestdoc.sxw
7791745ed9SLiu Zhe 		open(prepareData("smoketestdoc.sxw"));
7891745ed9SLiu Zhe 		writer.waitForEnabled(10, 2);
7991745ed9SLiu Zhe 		// Run test cases
8091745ed9SLiu Zhe 		app.dispatch("vnd.sun.star.script:Standard.Global.StartTestWithDefaultOptions?language=Basic&location=document", 120);
8191745ed9SLiu Zhe 		String smoketestlog = FileUtil.readFileAsString(new File(smoketestOutput, "smoketest.log"));
8291745ed9SLiu Zhe 		String testclosurelog = FileUtil.readFileAsString(new File(smoketestOutput, "testclosure.log"));
8391745ed9SLiu Zhe 		log.info(smoketestlog + "\n" + testclosurelog);
8491745ed9SLiu Zhe 		assertTrue("No Error", !smoketestlog.contains("error") && !testclosurelog.contains("error"));
8591745ed9SLiu Zhe 
8691745ed9SLiu Zhe 	}
8791745ed9SLiu Zhe 
88faa4b864SLei De Bin 	@Test
8932c31156SLiu Zhe 	public void testExportAsPDF() throws Exception {
90b4d2d410SLiu Zhe 		String file = prepareData("bvt/pdf.odt");
91b4d2d410SLiu Zhe 		String exportTo1 = getPath("temp/1.pdf");
92b4d2d410SLiu Zhe 		String exportTo2 = getPath("temp/2.pdf");
93b4d2d410SLiu Zhe 		deleteFile(exportTo1);
94b4d2d410SLiu Zhe 		deleteFile(exportTo2);
95b4d2d410SLiu Zhe 		open(file);
96b4d2d410SLiu Zhe 		writer.waitForExistence(10, 1);
97cb6199d5SLiu Zhe 		app.dispatch(".uno:ExportToPDF");
98b4d2d410SLiu Zhe 		pdfGeneralPage.ok();
99b4d2d410SLiu Zhe 		submitSaveDlg(exportTo1);
100b4d2d410SLiu Zhe 		sleep(1);
101b4d2d410SLiu Zhe 		String magic = FileUtil.readFileAsString(exportTo1).substring(0, 4);
102b4d2d410SLiu Zhe 		assertEquals("PDF is exported?", "%PDF", magic);
103b4d2d410SLiu Zhe 
104b4d2d410SLiu Zhe 		button(".uno:ExportDirectToPDF").click();//Click via toolbar
105b4d2d410SLiu Zhe 		submitSaveDlg(exportTo2);
106b4d2d410SLiu Zhe 		sleep(1);
107b4d2d410SLiu Zhe 		magic = FileUtil.readFileAsString(exportTo2).substring(0, 4);
108b4d2d410SLiu Zhe 		assertEquals("PDF is exported directly?", "%PDF", magic);
109faa4b864SLei De Bin 	}
11032c31156SLiu Zhe 
111faa4b864SLei De Bin 	/**
11232c31156SLiu Zhe 	 * Test the File -- Print Dialog show
113faa4b864SLei De Bin 	 *
11432c31156SLiu Zhe 	 */
115faa4b864SLei De Bin 	@Test
116b4d2d410SLiu Zhe 	public void testPrinter() {
11732c31156SLiu Zhe 		// Create a new text document
118b4d2d410SLiu Zhe 		newTextDocument();
119b4d2d410SLiu Zhe 		app.dispatch(".uno:PrinterSetup");
120b4d2d410SLiu Zhe 		if (activeMsgBox.exists(2))
121b4d2d410SLiu Zhe 			activeMsgBox.ok();
122b4d2d410SLiu Zhe 
123b4d2d410SLiu Zhe //		PrintService[] ps = PrintServiceLookup.lookupPrintServices(null, null);
124b4d2d410SLiu Zhe //		String[] names = new String[ps.length];
125b4d2d410SLiu Zhe //		for (int i = 0; i < ps.length; i++) {
126b4d2d410SLiu Zhe //			names[i] = ps[i].getName();
127b4d2d410SLiu Zhe //		}
128b4d2d410SLiu Zhe //
129b4d2d410SLiu Zhe //		assertArrayEquals("Printers Names", names, printerSetUpDlgPrinterNames.getItemsText());
130b4d2d410SLiu Zhe 		assertTrue("Printer Setup dialog appears", printerSetUpDlg.exists(3));
131b4d2d410SLiu Zhe 		printerSetUpDlg.cancel();
13232c31156SLiu Zhe 	}
13332c31156SLiu Zhe 
134faa4b864SLei De Bin 	/**
13532c31156SLiu Zhe 	 * Test the File -- Java Dialog show
136faa4b864SLei De Bin 	 *
13732c31156SLiu Zhe 	 */
138b4d2d410SLiu Zhe //	@Test
139b4d2d410SLiu Zhe //	public void testJavaDialog() {
140b4d2d410SLiu Zhe //
141b4d2d410SLiu Zhe //		// Create a new text document and launch a Wizards dialog which need JVM
142b4d2d410SLiu Zhe //		// work correctly.
143b4d2d410SLiu Zhe //		app.dispatch("private:factory/swriter");
144b4d2d410SLiu Zhe //		File tempfile = new File(oo.getUserInstallation(), "user/template/myAgendaTemplate.ott");
145b4d2d410SLiu Zhe //		FileUtil.deleteFile(tempfile);
146b4d2d410SLiu Zhe //		sleep(3);
147b4d2d410SLiu Zhe //		app.dispatch("service:com.sun.star.wizards.agenda.CallWizard?start");
148b4d2d410SLiu Zhe //		sleep(5);
149b4d2d410SLiu Zhe //		assertTrue(Wizards_AgendaDialog.exists(10));
150b4d2d410SLiu Zhe //		Wizards_AgendaDialog_FinishButton.click();
151b4d2d410SLiu Zhe //		sleep(10);
152b4d2d410SLiu Zhe //		writer.focus();
153b4d2d410SLiu Zhe //		sleep(1);
154b4d2d410SLiu Zhe //		app.dispatch(".uno:SelectAll");
155b4d2d410SLiu Zhe //		typeKeys("<$copy>");
156b4d2d410SLiu Zhe //		// System.out.println("now txt:"+app.getClipboard());
157b4d2d410SLiu Zhe //		// assertTrue(app.getClipboard().startsWith("<Name>"));
158b4d2d410SLiu Zhe //		assertNotNull(app.getClipboard());
159b4d2d410SLiu Zhe //	}
16032c31156SLiu Zhe 
161faa4b864SLei De Bin 	/**
16232c31156SLiu Zhe 	 * Test the Tools / Macros / Organize Dialogs" show
163faa4b864SLei De Bin 	 *
16432c31156SLiu Zhe 	 */
165faa4b864SLei De Bin 	@Test
166b4d2d410SLiu Zhe 	public void testRunMacro() {
167b4d2d410SLiu Zhe 		open(prepareData("bvt/macro.ods"));
168b4d2d410SLiu Zhe 		calc.waitForExistence(10, 2);
169b4d2d410SLiu Zhe 		app.dispatch(".uno:RunMacro");
170b4d2d410SLiu Zhe 		runMacroDlgCategories.expand("macro.ods");
171b4d2d410SLiu Zhe 		runMacroDlgCategories.expand("Standard");
172b4d2d410SLiu Zhe 		runMacroDlgCategories.select("Module1");
173b4d2d410SLiu Zhe 		runMacroDlgCommands.select(0);
174b4d2d410SLiu Zhe 		runMacroDlg.ok();
175b4d2d410SLiu Zhe 		assertEquals("A3 should be =1+3", "4", SCTool.getCellText("A3"));
176b4d2d410SLiu Zhe 		discard();
177faa4b864SLei De Bin 	}
17832c31156SLiu Zhe 
179faa4b864SLei De Bin 	/**
18032c31156SLiu Zhe 	 * Test the About Dialog show
181faa4b864SLei De Bin 	 *
18232c31156SLiu Zhe 	 */
183faa4b864SLei De Bin 	@Test
184b4d2d410SLiu Zhe 	public void testHelp() {
185cb6199d5SLiu Zhe 		app.dispatch(".uno:About");
186b4d2d410SLiu Zhe 		assertTrue(aboutDialog.exists(5));
187b4d2d410SLiu Zhe 		aboutDialog.ok();
188b4d2d410SLiu Zhe 		sleep(1);
189b4d2d410SLiu Zhe 		typeKeys("<F1>");
190b4d2d410SLiu Zhe 		assertTrue(helpWindow.exists(5));
191b4d2d410SLiu Zhe 		helpWindow.close();
192faa4b864SLei De Bin 	}
19332c31156SLiu Zhe 
194faa4b864SLei De Bin 	/**
195faa4b864SLei De Bin 	 * Test inserting a picture in text document
19632c31156SLiu Zhe 	 *
197faa4b864SLei De Bin 	 * @throws Exception
198faa4b864SLei De Bin 	 */
19932c31156SLiu Zhe 
200faa4b864SLei De Bin 	@Test
201faa4b864SLei De Bin 	public void testInsertPictureInDocument() throws Exception {
2026b55ece7SLiu Zhe 		String bmp_green = prepareData("image/green_256x256.bmp");
2036b55ece7SLiu Zhe 		String bmp_red = prepareData("image/red_256x256.bmp");
20432c31156SLiu Zhe 
20532c31156SLiu Zhe 		// Create a new text document
206b4d2d410SLiu Zhe 		newTextDocument();
20732c31156SLiu Zhe 		// Insert a picture fully filled with green
20832c31156SLiu Zhe 		app.dispatch(".uno:InsertGraphic");
209faa4b864SLei De Bin 		submitOpenDlg(bmp_green);
210b4d2d410SLiu Zhe 		writer.click(5,200);
211faa4b864SLei De Bin 		sleep(1);
21232c31156SLiu Zhe 
213faa4b864SLei De Bin 		// Verify if the picture is inserted successfully
21422a14f28SLiu Zhe 		Rectangle rectangle = GraphicsUtil.findRectangle(writer.getScreenRectangle(), 0xFF00FF00);
215b4d2d410SLiu Zhe 		assertTrue("Green Picture is inserted?" + rectangle, rectangle != null && rectangle.getWidth() > 10);
21632c31156SLiu Zhe 		// insert another picture
21732c31156SLiu Zhe 		app.dispatch(".uno:InsertGraphic");
218faa4b864SLei De Bin 		submitOpenDlg(bmp_red);
219b4d2d410SLiu Zhe 		writer.click(5, 200);
220faa4b864SLei De Bin 		sleep(1);
221faa4b864SLei De Bin 		// Verify if the picture is inserted successfully
22222a14f28SLiu Zhe 		rectangle = GraphicsUtil.findRectangle(writer.getScreenRectangle(), 0xFFFF0000);
223b4d2d410SLiu Zhe 		assertTrue("Green Picture is inserted? " + rectangle, rectangle != null && rectangle.getWidth() > 10);
224b4d2d410SLiu Zhe 		discard();
225faa4b864SLei De Bin 	}
226faa4b864SLei De Bin 
227faa4b864SLei De Bin 	@Test
228faa4b864SLei De Bin 	public void testInsertPictureInSpreadsheet() throws Exception {
229b4d2d410SLiu Zhe 		String bmp_green = prepareData("image/green_64x64.png");
230b4d2d410SLiu Zhe 		String bmp_red = prepareData("image/red_64x64.png");
231b4d2d410SLiu Zhe 		newSpreadsheet();
23232c31156SLiu Zhe 		// Insert a picture fully filled with green
23332c31156SLiu Zhe 		app.dispatch(".uno:InsertGraphic");
234faa4b864SLei De Bin 		submitOpenDlg(bmp_green);
235b4d2d410SLiu Zhe 		calc.click(5, 150);
236faa4b864SLei De Bin 		sleep(1);
23732c31156SLiu Zhe 
238faa4b864SLei De Bin 		// Verify if the picture is inserted successfully
23922a14f28SLiu Zhe 		Rectangle rectangle = GraphicsUtil.findRectangle(calc.getScreenRectangle(), 0xFF00FF00);
240b4d2d410SLiu Zhe 		assertTrue("Green Picture is inserted?" + rectangle, rectangle != null && rectangle.getWidth() > 10);
241b4d2d410SLiu Zhe 
242b4d2d410SLiu Zhe 		SCTool.selectRange("C1");
24332c31156SLiu Zhe 		// insert another picture
24432c31156SLiu Zhe 		app.dispatch(".uno:InsertGraphic");
245faa4b864SLei De Bin 		submitOpenDlg(bmp_red);
246b4d2d410SLiu Zhe 		calc.click(5, 150);
247faa4b864SLei De Bin 		sleep(1);
248faa4b864SLei De Bin 		// Verify if the picture is inserted successfully
24922a14f28SLiu Zhe 		rectangle = GraphicsUtil.findRectangle(calc.getScreenRectangle(), 0xFFFF0000);
250b4d2d410SLiu Zhe 		assertTrue("Red Picture is inserted? " + rectangle, rectangle != null && rectangle.getWidth() > 10);
251b4d2d410SLiu Zhe 		discard();
252faa4b864SLei De Bin 	}
25332c31156SLiu Zhe 
254faa4b864SLei De Bin 	@Test
255faa4b864SLei De Bin 	public void testInsertPictureInPresentation() throws Exception {
2566b55ece7SLiu Zhe 		String bmp_green = prepareData("image/green_256x256.bmp");
2576b55ece7SLiu Zhe 		String bmp_red = prepareData("image/red_256x256.bmp");
258b4d2d410SLiu Zhe 		newPresentation();
25932c31156SLiu Zhe 		// Insert a picture fully filled with green
26032c31156SLiu Zhe 		app.dispatch(".uno:InsertGraphic");
261faa4b864SLei De Bin 		submitOpenDlg(bmp_green);
26232c31156SLiu Zhe 		impress.click(5, 5);
263faa4b864SLei De Bin 		sleep(1);
26432c31156SLiu Zhe 
265faa4b864SLei De Bin 		// Verify if the picture is inserted successfully
26622a14f28SLiu Zhe 		Rectangle rectangle = GraphicsUtil.findRectangle(impress.getScreenRectangle(), 0xFF00FF00);
267b4d2d410SLiu Zhe 		assertTrue("Green Picture is inserted?" + rectangle, rectangle != null && rectangle.getWidth() > 10);
26832c31156SLiu Zhe 		// insert another picture
26932c31156SLiu Zhe 		app.dispatch(".uno:InsertGraphic");
270faa4b864SLei De Bin 		submitOpenDlg(bmp_red);
271faa4b864SLei De Bin 		impress.click(1, 1);
272faa4b864SLei De Bin 		sleep(1);
273faa4b864SLei De Bin 		// Verify if the picture is inserted successfully
27422a14f28SLiu Zhe 		rectangle = GraphicsUtil.findRectangle(impress.getScreenRectangle(), 0xFFFF0000);
275b4d2d410SLiu Zhe 		assertTrue("Red Picture is inserted? " + rectangle, rectangle != null && rectangle.getWidth() > 10);
276b4d2d410SLiu Zhe 		discard();
277faa4b864SLei De Bin 	}
27832c31156SLiu Zhe 
279faa4b864SLei De Bin 	@Test
280faa4b864SLei De Bin 	public void testSlideShow() throws Exception {
281b4d2d410SLiu Zhe 		open(prepareData("bvt/slideshow.odp"));
282faa4b864SLei De Bin 		impress.waitForExistence(10, 2);
283b4d2d410SLiu Zhe 		sleep(1);
284b4d2d410SLiu Zhe 		impress.typeKeys("<F5>");
285faa4b864SLei De Bin 		sleep(3);
286b4d2d410SLiu Zhe 		Rectangle rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFFFF0000);
287faa4b864SLei De Bin 		assertNotNull("1st slide appears", rectangle);
288b4d2d410SLiu Zhe 		slideShow.click(0.5, 0.5);
289faa4b864SLei De Bin 		sleep(2);
290b4d2d410SLiu Zhe 		rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFF00FF00);
291faa4b864SLei De Bin 		assertNotNull("2nd slide appears", rectangle);
292faa4b864SLei De Bin 		typeKeys("<enter>");
293faa4b864SLei De Bin 		sleep(2);
294b4d2d410SLiu Zhe 		rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFF0000FF);
295faa4b864SLei De Bin 		assertNotNull("3rd slide appears", rectangle);
296b4d2d410SLiu Zhe 		slideShow.click(0.5, 0.5);
297faa4b864SLei De Bin 		sleep(2);
298b4d2d410SLiu Zhe 		rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFF0000FF);
299faa4b864SLei De Bin 		assertNull("The end", rectangle);
300b4d2d410SLiu Zhe 		slideShow.click(0.5, 0.5);
301faa4b864SLei De Bin 		sleep(3);
302b4d2d410SLiu Zhe 		assertFalse("Quit", slideShow.exists());
303faa4b864SLei De Bin 	}
30432c31156SLiu Zhe 
305faa4b864SLei De Bin 	@Test
306faa4b864SLei De Bin 	public void testFind() {
307b4d2d410SLiu Zhe 		open(prepareData("bvt/find.odt"));
308faa4b864SLei De Bin 		writer.waitForExistence(10, 2);
30932c31156SLiu Zhe 		app.dispatch(".uno:SearchDialog");
310b4d2d410SLiu Zhe 		findDlgFor.setText("OpenOffice");
311b4d2d410SLiu Zhe 		findDlgFind.click();
312faa4b864SLei De Bin 		sleep(1);
313b4d2d410SLiu Zhe 		writer.typeKeys("<$copy>");
314faa4b864SLei De Bin 		assertEquals("OpenOffice", app.getClipboard());
315b4d2d410SLiu Zhe 		findDlgFindAll.click();
316faa4b864SLei De Bin 		sleep(1);
317b4d2d410SLiu Zhe 		writer.typeKeys("<$copy>");
318faa4b864SLei De Bin 		assertEquals("OpenOfficeOpenOfficeOpenOffice", app.getClipboard());
319b4d2d410SLiu Zhe 		findDlgReplaceWith.setText("Awesome OpenOffice");
320b4d2d410SLiu Zhe 		findDlgReplaceAll.click();
321faa4b864SLei De Bin 		sleep(1);
322faa4b864SLei De Bin 		msgbox("Search key replaced 3 times.").ok();
323b4d2d410SLiu Zhe 		findDlg.close();
324faa4b864SLei De Bin 		sleep(1);
32532c31156SLiu Zhe 		assertEquals(
32632c31156SLiu Zhe 				"Apache Awesome OpenOffice is comprised of six personal productivity applications: a word processor (and its web-authoring component), spreadsheet, presentation graphics, drawing, equation editor, and database. Awesome OpenOffice is released on Windows, Solaris, Linux and Macintosh operation systems, with more communities joining, including a mature FreeBSD port. Awesome OpenOffice is localized, supporting over 110 languages worldwide. ",
327b4d2d410SLiu Zhe 				copyAll());
328faa4b864SLei De Bin 	}
32932c31156SLiu Zhe 
330faa4b864SLei De Bin 	@Test
331faa4b864SLei De Bin 	public void testFillInSpreadsheet() {
33222a14f28SLiu Zhe 		String[][] expected1 = new String[][] { { "1" }, { "1" }, { "1" }, { "1" }, { "1" }, { "1" }, };
33322a14f28SLiu Zhe 		String[][] expected2 = new String[][] { { "2" }, { "2" }, { "2" }, { "2" }, { "2" }, { "2" }, };
33422a14f28SLiu Zhe 		String[][] expected3 = new String[][] { { "Hi friends", "Hi friends", "Hi friends", "Hi friends" } };
33522a14f28SLiu Zhe 		String[][] expected4 = new String[][] { { "99999.999", "99999.999", "99999.999", "99999.999" } };
336faa4b864SLei De Bin 		String[][] expected5 = new String[][] {
33722a14f28SLiu Zhe 		{ "99999.999", "-10" }, { "100000.999", "-9" }, { "100001.999", "-8" }, { "100002.999", "-7" }, { "100003.999", "-6" }
338faa4b864SLei De Bin 		};
339b4d2d410SLiu Zhe 		newSpreadsheet();
340b4d2d410SLiu Zhe 		SCTool.selectRange("C5");
341faa4b864SLei De Bin 		typeKeys("1<enter>");
342b4d2d410SLiu Zhe 		SCTool.selectRange("C5:C10");
34332c31156SLiu Zhe 		app.dispatch(".uno:FillDown");
344b4d2d410SLiu Zhe 		assertArrayEquals("Fill Down:", expected1, SCTool.getCellTexts("C5:C10"));
34532c31156SLiu Zhe 
346b4d2d410SLiu Zhe 		SCTool.selectRange("D10");
347faa4b864SLei De Bin 		typeKeys("2<enter>");
348b4d2d410SLiu Zhe 		SCTool.selectRange("D5:D10");
34932c31156SLiu Zhe 		app.dispatch(".uno:FillUp");
350b4d2d410SLiu Zhe 		assertArrayEquals("Fill Up:", expected2, SCTool.getCellTexts("D5:D10"));
35132c31156SLiu Zhe 
352b4d2d410SLiu Zhe 		SCTool.selectRange("A1");
353faa4b864SLei De Bin 		typeKeys("Hi friends<enter>");
354b4d2d410SLiu Zhe 		SCTool.selectRange("A1:D1");
35532c31156SLiu Zhe 		app.dispatch(".uno:FillRight");
356b4d2d410SLiu Zhe 		assertArrayEquals("Fill Right:", expected3, SCTool.getCellTexts("A1:D1"));
35732c31156SLiu Zhe 
358b4d2d410SLiu Zhe 		SCTool.selectRange("D2");
359faa4b864SLei De Bin 		typeKeys("99999.999<enter>");
360b4d2d410SLiu Zhe 		SCTool.selectRange("A2:D2");
36132c31156SLiu Zhe 		app.dispatch(".uno:FillLeft");
362b4d2d410SLiu Zhe 		assertArrayEquals("Fill left:", expected4, SCTool.getCellTexts("A2:D2"));
363faa4b864SLei De Bin 
364b4d2d410SLiu Zhe 		SCTool.selectRange("E1");
365faa4b864SLei De Bin 		typeKeys("99999.999<tab>-10<enter>");
36632c31156SLiu Zhe 
367b4d2d410SLiu Zhe 		SCTool.selectRange("E1:F5");
36832c31156SLiu Zhe 		app.dispatch(".uno:FillSeries");
369b4d2d410SLiu Zhe 		fillSeriesDlg.ok();
370faa4b864SLei De Bin 		sleep(1);
371b4d2d410SLiu Zhe 		assertArrayEquals("Fill series..", expected5, SCTool.getCellTexts("E1:F5"));
372b4d2d410SLiu Zhe 		discard();
373faa4b864SLei De Bin 	}
37432c31156SLiu Zhe 
375faa4b864SLei De Bin 	@Test
376faa4b864SLei De Bin 	public void testSort() {
37722a14f28SLiu Zhe 		String[][] expected1 = new String[][] { { "-9999999" }, { "-1.1" }, { "-1.1" }, { "0" }, { "0" }, { "0.1" }, { "10" }, { "12" }, { "9999999" }, { "9999999" },
378faa4b864SLei De Bin 
379faa4b864SLei De Bin 		};
38022a14f28SLiu Zhe 		String[][] expected2 = new String[][] { { "TRUE", "Oracle" }, { "TRUE", "OpenOffice" }, { "FALSE", "OpenOffice" }, { "TRUE", "IBM" }, { "FALSE", "IBM" },
38122a14f28SLiu Zhe 				{ "TRUE", "Google" }, { "FALSE", "facebook " }, { "TRUE", "Apache" }, { "TRUE", "!yahoo" }, { "TRUE", "" },
382faa4b864SLei De Bin 
383faa4b864SLei De Bin 		};
384faa4b864SLei De Bin 
38522a14f28SLiu Zhe 		String[][] expected3 = new String[][] { { "Sunday" }, { "Monday" }, { "Tuesday" }, { "Wednesday" }, { "Thursday" }, { "Friday" }, { "Saturday" },
386faa4b864SLei De Bin 
387faa4b864SLei De Bin 		};
38832c31156SLiu Zhe 
38922a14f28SLiu Zhe 		String[][] expected4 = new String[][] { { "-$10.00" }, { "$0.00" }, { "$0.00" }, { "$1.00" }, { "$3.00" }, { "$9.00" }, { "$123.00" }, { "$200.00" }, { "$400.00" },
39022a14f28SLiu Zhe 				{ "$10,000.00" },
391faa4b864SLei De Bin 
392faa4b864SLei De Bin 		};
393b4d2d410SLiu Zhe 		open(prepareData("bvt/sort.ods"));
394faa4b864SLei De Bin 		calc.waitForExistence(10, 2);
395b4d2d410SLiu Zhe 		SCTool.selectRange("A1:A10");
396cb6199d5SLiu Zhe 		app.dispatch(".uno:DataSort");
397b4d2d410SLiu Zhe 		sortWarningDlgCurrent.click();
398b4d2d410SLiu Zhe 		assertEquals(1, sortPageBy1.getSelIndex());
399b4d2d410SLiu Zhe 		sortPage.ok();
400faa4b864SLei De Bin 		sleep(1);
401b4d2d410SLiu Zhe 		assertArrayEquals("Sorted Data", expected1, SCTool.getCellTexts("A1:A10"));
402b4d2d410SLiu Zhe 		SCTool.selectRange("B1:C10");
403cb6199d5SLiu Zhe 		app.dispatch(".uno:DataSort");
4047dd7871fSLei De Bin 
405b4d2d410SLiu Zhe 		sortPageBy1.select(2);
406b4d2d410SLiu Zhe 		sortPageDescending1.check();
407b4d2d410SLiu Zhe 		assertFalse(sortPageBy3.isEnabled());
408b4d2d410SLiu Zhe 		assertFalse(sortPageAscending3.isEnabled());
409b4d2d410SLiu Zhe 		assertFalse(sortPageDescending3.isEnabled());
410b4d2d410SLiu Zhe 		sortPageBy2.select(1);
411b4d2d410SLiu Zhe 		assertTrue(sortPageBy3.isEnabled());
412b4d2d410SLiu Zhe 		assertTrue(sortPageAscending3.isEnabled());
413b4d2d410SLiu Zhe 		assertTrue(sortPageDescending3.isEnabled());
414b4d2d410SLiu Zhe 		sortPageDescending2.check();
415b4d2d410SLiu Zhe 		sortPageBy2.select(0);
416b4d2d410SLiu Zhe 		assertFalse(sortPageBy3.isEnabled());
417b4d2d410SLiu Zhe 		assertFalse(sortPageAscending3.isEnabled());
418b4d2d410SLiu Zhe 		assertFalse(sortPageDescending3.isEnabled());
419b4d2d410SLiu Zhe 		sortPageBy2.select(1);
420b4d2d410SLiu Zhe 		sortPage.ok();
421faa4b864SLei De Bin 		sleep(1);
42232c31156SLiu Zhe 
423b4d2d410SLiu Zhe 		assertArrayEquals("Sorted Data", expected2, SCTool.getCellTexts("B1:C10"));
424b4d2d410SLiu Zhe 		SCTool.selectRange("D1:D7");
425cb6199d5SLiu Zhe 		app.dispatch(".uno:DataSort");
426b4d2d410SLiu Zhe 		sortWarningDlgCurrent.click();
427b4d2d410SLiu Zhe 		sortOptionsPage.select();
428b4d2d410SLiu Zhe 		sortOptionsPageRangeContainsColumnLabels.uncheck();
429b4d2d410SLiu Zhe 		sortOptionsPageCustomSortOrder.check();
430b4d2d410SLiu Zhe 		sortOptionsPageCustomSortOrderList.select("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday");
431b4d2d410SLiu Zhe 		sortOptionsPage.ok();
432faa4b864SLei De Bin 		sleep(1);
433b4d2d410SLiu Zhe 		assertArrayEquals("Sorted Data", expected3, SCTool.getCellTexts("D1:D7"));
43432c31156SLiu Zhe 
435b4d2d410SLiu Zhe 		SCTool.selectRange("E1:E10");
436cb6199d5SLiu Zhe 		app.dispatch(".uno:DataSort");
437b4d2d410SLiu Zhe 		sortWarningDlgCurrent.click();
438b4d2d410SLiu Zhe 		sortPage.ok();
439faa4b864SLei De Bin 		sleep(1);
440b4d2d410SLiu Zhe 		assertArrayEquals("Sorted Data", expected4, SCTool.getCellTexts("E1:E10"));
441b4d2d410SLiu Zhe 		discard();
442faa4b864SLei De Bin 	}
44332c31156SLiu Zhe 
4447dd2b5bbSLiu Zhe 	/**
44532c31156SLiu Zhe 	 * Test insert a chart in a draw document 1. New a draw document 2. Insert a
44632c31156SLiu Zhe 	 * chart 3. Check if the chart is inserted successfully
44732c31156SLiu Zhe 	 *
4487dd2b5bbSLiu Zhe 	 * @throws Exception
4497dd2b5bbSLiu Zhe 	 */
4507dd2b5bbSLiu Zhe 	@Test
45132c31156SLiu Zhe 	public void testInsertChartInDraw() throws Exception {
4527dd2b5bbSLiu Zhe 		// Create a new drawing document
453b4d2d410SLiu Zhe 		newDrawing();
4547dd2b5bbSLiu Zhe 		// Insert a chart
45532c31156SLiu Zhe 		app.dispatch(".uno:InsertObjectChart");
4567dd2b5bbSLiu Zhe 		sleep(3);
45732c31156SLiu Zhe 
4587dd2b5bbSLiu Zhe 		// Verify if the chart is inserted successfully
459b4d2d410SLiu Zhe 		assertTrue("Chart Editor appears", chart.exists(3));
4607dd2b5bbSLiu Zhe 		// Focus on edit pane
46132c31156SLiu Zhe 		draw.click(5, 5);
4627dd2b5bbSLiu Zhe 		sleep(1);
463b4d2d410SLiu Zhe 		assertFalse("Chart Editor appears", chart.exists());
464b4d2d410SLiu Zhe 		discard();
4657dd2b5bbSLiu Zhe 	}
46632c31156SLiu Zhe 
4677dd2b5bbSLiu Zhe 	/**
46832c31156SLiu Zhe 	 * Test insert a chart in a text document 1. New a text document 2. Insert a
46932c31156SLiu Zhe 	 * chart 3. Check if the chart is inserted successfully
47032c31156SLiu Zhe 	 *
4717dd2b5bbSLiu Zhe 	 * @throws Exception
4727dd2b5bbSLiu Zhe 	 */
4737dd2b5bbSLiu Zhe 	@Test
47432c31156SLiu Zhe 	public void testInsertChartInDocument() throws Exception {
4757dd2b5bbSLiu Zhe 		// Create a new text document
476b4d2d410SLiu Zhe 		newTextDocument();
4777dd2b5bbSLiu Zhe 		// Insert a chart
47832c31156SLiu Zhe 		app.dispatch(".uno:InsertObjectChart");
4797dd2b5bbSLiu Zhe 		sleep(3);
48032c31156SLiu Zhe 
4817dd2b5bbSLiu Zhe 		// Verify if the chart is inserted successfully
482b4d2d410SLiu Zhe 		assertTrue("Chart Editor appears", chart.exists(3));
4837dd2b5bbSLiu Zhe 		// Focus on edit pane
48432c31156SLiu Zhe 		writer.click(5, 5);
4857dd2b5bbSLiu Zhe 		sleep(1);
486b4d2d410SLiu Zhe 		assertFalse("Chart Editor appears", chart.exists());
487b4d2d410SLiu Zhe 		discard();
4887dd2b5bbSLiu Zhe 	}
48932c31156SLiu Zhe 
4907dd2b5bbSLiu Zhe 	/**
49132c31156SLiu Zhe 	 * Test insert a chart in a spreadsheet document 1. New a spreadsheet
49232c31156SLiu Zhe 	 * document 2. Insert a chart 3. Check if the chart is inserted successfully
49332c31156SLiu Zhe 	 *
4947dd2b5bbSLiu Zhe 	 * @throws Exception
4957dd2b5bbSLiu Zhe 	 */
4967dd2b5bbSLiu Zhe 	@Test
49732c31156SLiu Zhe 	public void testInsertChartInSpreadsheet() throws Exception {
4987dd2b5bbSLiu Zhe 		// Create a new spreadsheet document
499b4d2d410SLiu Zhe 		newSpreadsheet();
5007dd2b5bbSLiu Zhe 		// Insert a chart
50132c31156SLiu Zhe 		app.dispatch(".uno:InsertObjectChart");
5027dd2b5bbSLiu Zhe 		sleep(3);
503b4d2d410SLiu Zhe 		chartWizard.ok();
50432c31156SLiu Zhe 
5057dd2b5bbSLiu Zhe 		// Verify if the chart is inserted successfully
506b4d2d410SLiu Zhe 		assertTrue("Chart Editor appears", chart.exists(3));
5077dd2b5bbSLiu Zhe 		// Focus on edit pane
50832c31156SLiu Zhe 		calc.click(5, 5);
50932c31156SLiu Zhe 		sleep(1);
510b4d2d410SLiu Zhe 		assertFalse("Chart Editor appears", chart.exists());
511b4d2d410SLiu Zhe 		discard();
5127dd2b5bbSLiu Zhe 	}
51332c31156SLiu Zhe 
5147dd2b5bbSLiu Zhe 	/**
51532c31156SLiu Zhe 	 * Test insert a chart in a presentation document 1. New a presentation
51632c31156SLiu Zhe 	 * document 2. Insert a chart 3. Check if the chart is inserted successfully
51732c31156SLiu Zhe 	 *
5187dd2b5bbSLiu Zhe 	 * @throws Exception
5197dd2b5bbSLiu Zhe 	 */
5202aaec72aSLiu Zhe 	@Test
52132c31156SLiu Zhe 	public void testInsertChartInPresentation() throws Exception {
5227dd2b5bbSLiu Zhe 		// Create a new presentation document
523b4d2d410SLiu Zhe 		newPresentation();
5247dd2b5bbSLiu Zhe 		// Insert a chart
52532c31156SLiu Zhe 		app.dispatch(".uno:InsertObjectChart");
5267dd2b5bbSLiu Zhe 		sleep(3);
5277dd2b5bbSLiu Zhe 		// Verify if the chart is inserted successfully
528b4d2d410SLiu Zhe 		assertTrue("Chart Editor appears", chart.exists(3));
5297dd2b5bbSLiu Zhe 		// Focus on edit pane
53032c31156SLiu Zhe 		impress.click(5, 5);
53132c31156SLiu Zhe 		sleep(1);
532b4d2d410SLiu Zhe 		assertFalse("Chart Editor appears", chart.exists());
533b4d2d410SLiu Zhe 		discard();
5347dd2b5bbSLiu Zhe 	}
53532c31156SLiu Zhe 
5367dd2b5bbSLiu Zhe 	/**
53732c31156SLiu Zhe 	 * Test insert a table in a draw document 1. New a draw document 2. Insert a
53832c31156SLiu Zhe 	 * default table 3. Check if the table is inserted successfully
53932c31156SLiu Zhe 	 *
5407dd2b5bbSLiu Zhe 	 * @throws Exception
5417dd2b5bbSLiu Zhe 	 */
5427dd2b5bbSLiu Zhe 	@Test
54332c31156SLiu Zhe 	public void testInsertTableInDraw() throws Exception {
5447dd2b5bbSLiu Zhe 		// Create a new drawing document
545b4d2d410SLiu Zhe 		newDrawing();
5467dd2b5bbSLiu Zhe 		// Insert a table
54732c31156SLiu Zhe 		app.dispatch(".uno:InsertTable");
548b4d2d410SLiu Zhe 		insertTable.ok();
5497dd2b5bbSLiu Zhe 		sleep(1);
550b4d2d410SLiu Zhe 		draw.typeKeys("3");
551b4d2d410SLiu Zhe 		assertTrue("Table Toolbar appears", tableToolbar.exists(3));
552b4d2d410SLiu Zhe //		assertEquals("The cell content", "3", copyAll());
553b4d2d410SLiu Zhe 		discard();
5547dd2b5bbSLiu Zhe 	}
55532c31156SLiu Zhe 
5567dd2b5bbSLiu Zhe 	/**
55732c31156SLiu Zhe 	 * Test insert a table in a text document 1. New a text document 2. Insert a
55832c31156SLiu Zhe 	 * default table 3. Check if the table is inserted successfully
55932c31156SLiu Zhe 	 *
5607dd2b5bbSLiu Zhe 	 * @throws Exception
5617dd2b5bbSLiu Zhe 	 */
5627dd2b5bbSLiu Zhe 	@Test
56332c31156SLiu Zhe 	public void testInsertTableInDocument() throws Exception {
5647dd2b5bbSLiu Zhe 		// Create a new text document
565b4d2d410SLiu Zhe 		newTextDocument();
5667dd2b5bbSLiu Zhe 		// Insert a table
56732c31156SLiu Zhe 		app.dispatch(".uno:InsertTable");
568b4d2d410SLiu Zhe 		writerInsertTable.ok();
5697dd2b5bbSLiu Zhe 		sleep(1);
570b4d2d410SLiu Zhe 		writer.typeKeys("3");
571b4d2d410SLiu Zhe 		// Verify if the table toolbar is active
572b4d2d410SLiu Zhe 		assertTrue("Table Toolbar appears", tableToolbar.exists(3));
573b4d2d410SLiu Zhe //		assertEquals("The cell content", "3", copyAll());
574b4d2d410SLiu Zhe 		discard();
5757dd2b5bbSLiu Zhe 	}
57632c31156SLiu Zhe 
5777dd2b5bbSLiu Zhe 	/**
57832c31156SLiu Zhe 	 * Test insert a table in a presentation document 1. New a presentation
57932c31156SLiu Zhe 	 * document 2. Insert a default table 3. Check if the table is inserted
58032c31156SLiu Zhe 	 * successfully
58132c31156SLiu Zhe 	 *
5827dd2b5bbSLiu Zhe 	 * @throws Exception
5837dd2b5bbSLiu Zhe 	 */
5847dd2b5bbSLiu Zhe 	@Test
58532c31156SLiu Zhe 	public void testInsertTableInPresentation() throws Exception {
5867dd2b5bbSLiu Zhe 		// Create a new presentation document
587b4d2d410SLiu Zhe 		newPresentation();
58832c31156SLiu Zhe 
5897dd2b5bbSLiu Zhe 		// Insert a table
59032c31156SLiu Zhe 		app.dispatch(".uno:InsertTable");
591b4d2d410SLiu Zhe 		insertTable.ok();
5927dd2b5bbSLiu Zhe 		sleep(1);
593b4d2d410SLiu Zhe 		impress.typeKeys("3");
594b4d2d410SLiu Zhe 		assertTrue("Table Toolbar appears", tableToolbar.exists(3));
595b4d2d410SLiu Zhe //		assertEquals("The cell content", "3", copyAll());
596b4d2d410SLiu Zhe 		discard();
5977dd2b5bbSLiu Zhe 	}
5987dd2b5bbSLiu Zhe 
5997dd2b5bbSLiu Zhe 	/**
60032c31156SLiu Zhe 	 * Test insert a function in a spreadsheet document via Sum button 1. New a
60132c31156SLiu Zhe 	 * spreadsheet document 2. Insert a function via Sum button 3. Check if the
60232c31156SLiu Zhe 	 * result is correct
60332c31156SLiu Zhe 	 *
6047dd2b5bbSLiu Zhe 	 * @throws Exception
6057dd2b5bbSLiu Zhe 	 */
6067dd2b5bbSLiu Zhe 	@Test
607b4d2d410SLiu Zhe 	public void testSumInFormulaBar() throws Exception {
6087dd2b5bbSLiu Zhe 		// Create a new spreadsheet document
609b4d2d410SLiu Zhe 		newSpreadsheet();
6107dd2b5bbSLiu Zhe 		// Insert source numbers
6117dd2b5bbSLiu Zhe 		String sourceNumber1 = "5";
6127dd2b5bbSLiu Zhe 		String sourceNumber2 = "3";
6137dd2b5bbSLiu Zhe 		String expectedResult = "8";
614b4d2d410SLiu Zhe 		SCTool.selectRange("A1");
6157dd2b5bbSLiu Zhe 		typeKeys(sourceNumber1);
616b4d2d410SLiu Zhe 		SCTool.selectRange("B1");
61732c31156SLiu Zhe 		typeKeys(sourceNumber2);
6187dd2b5bbSLiu Zhe 		// Insert a function via Sum button
619b4d2d410SLiu Zhe 		SCTool.selectRange("C1");
620b4d2d410SLiu Zhe 		scInputBarSum.click();
6217dd2b5bbSLiu Zhe 		typeKeys("<enter>");
6227dd2b5bbSLiu Zhe 		// Verify if the calculated result is equal to the expected result
623b4d2d410SLiu Zhe 		assertEquals("The calculated result", expectedResult, SCTool.getCellText("C1"));
624b4d2d410SLiu Zhe 		discard();
6257dd2b5bbSLiu Zhe 	}
62632c31156SLiu Zhe 
6277dd2b5bbSLiu Zhe 	/**
62832c31156SLiu Zhe 	 * Test insert a function in a spreadsheet document via inputbar 1. New a
62932c31156SLiu Zhe 	 * spreadsheet document 2. Insert a function via inputbar: COS 3. Check if
63032c31156SLiu Zhe 	 * the result is correct
63132c31156SLiu Zhe 	 *
6327dd2b5bbSLiu Zhe 	 * @throws Exception
6337dd2b5bbSLiu Zhe 	 */
6347dd2b5bbSLiu Zhe 	@Test
635b4d2d410SLiu Zhe 	public void testInsertFunctionViaFormulaBar() throws Exception {
6367dd2b5bbSLiu Zhe 		// Create a new spreadsheet document
637b4d2d410SLiu Zhe 		newSpreadsheet();
6387dd2b5bbSLiu Zhe 		// Insert source numbers and expected result
63932c31156SLiu Zhe 		String sourceData = "0";
64032c31156SLiu Zhe 		String expectedResult = "1";
641b4d2d410SLiu Zhe 		SCTool.selectRange("A1");
64232c31156SLiu Zhe 		typeKeys(sourceData);
64332c31156SLiu Zhe 
64432c31156SLiu Zhe 		// Insert a function via inputbar: COS
645b4d2d410SLiu Zhe 		SCTool.selectRange("D1");
646b4d2d410SLiu Zhe 		scInputBarInput.inputKeys("=COS(A1)");
6477dd2b5bbSLiu Zhe 		typeKeys("<enter>");
64832c31156SLiu Zhe 
6497dd2b5bbSLiu Zhe 		// Verify if the calculated result is equal to the expected result
650b4d2d410SLiu Zhe 		assertEquals("The calculated result", expectedResult, SCTool.getCellText("D1"));
651b4d2d410SLiu Zhe 		discard();
6527dd2b5bbSLiu Zhe 	}
65332c31156SLiu Zhe 
6547dd2b5bbSLiu Zhe 	/**
65532c31156SLiu Zhe 	 * Test insert a function in a spreadsheet document via Function Wizard
65632c31156SLiu Zhe 	 * Dialog 1. New a spreadsheet document 2. Insert a function via Function
65732c31156SLiu Zhe 	 * Wizard Dialog: ABS 3. Check if the result is correct
65832c31156SLiu Zhe 	 *
6597dd2b5bbSLiu Zhe 	 * @throws Exception
6607dd2b5bbSLiu Zhe 	 */
6617dd2b5bbSLiu Zhe 	@Test
662b4d2d410SLiu Zhe 	public void testFunctionWizardInFormulaBar() throws Exception {
6637dd2b5bbSLiu Zhe 		// Create a new spreadsheet document
664b4d2d410SLiu Zhe 		newSpreadsheet();
6657dd2b5bbSLiu Zhe 		// Insert source number
6667dd2b5bbSLiu Zhe 		String sourceNumber = "-5";
6677dd2b5bbSLiu Zhe 		String expectedResult = "5";
668b4d2d410SLiu Zhe 		SCTool.selectRange("A1");
6697dd2b5bbSLiu Zhe 		typeKeys(sourceNumber);
6707dd2b5bbSLiu Zhe 		typeKeys("<enter>");
6717dd2b5bbSLiu Zhe 		// Insert a function via Function Wizard Dialog: ABS
672b4d2d410SLiu Zhe 		SCTool.selectRange("B1");
67332c31156SLiu Zhe 		app.dispatch(".uno:FunctionDialog");
67422a14f28SLiu Zhe 		// SC_FunctionWizardDlg_FunctionList.doubleClick(5, 5);
675b4d2d410SLiu Zhe 		scFunctionWizardDlgFunctionList.select("ABS");
676b4d2d410SLiu Zhe 		scFunctionWizardDlgNext.click(); // Use "Next" button
677b4d2d410SLiu Zhe 		scFunctionWizardDlgEdit1.inputKeys("A1");
678b4d2d410SLiu Zhe 		scFunctionWizardDlg.ok();
6797dd2b5bbSLiu Zhe 		// Verify if the calculated result is equal to the expected result
680b4d2d410SLiu Zhe 		assertEquals("The calculated result", expectedResult, SCTool.getCellText("B1"));
681b4d2d410SLiu Zhe 		discard();
6827dd2b5bbSLiu Zhe 	}
683faa4b864SLei De Bin }
684