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 569edf8282SLiu Zhe public static void beforeClass() { 57b4d2d410SLiu Zhe app.clean(); 582fc12ec5SLiu Zhe } 592fc12ec5SLiu Zhe 6091745ed9SLiu Zhe @AfterClass 619edf8282SLiu Zhe public static void afterClass() { 629edf8282SLiu Zhe app.stop(); 6391745ed9SLiu Zhe } 6491745ed9SLiu Zhe 65b4d2d410SLiu Zhe @Before 66b4d2d410SLiu Zhe public void before() { 679edf8282SLiu Zhe app.stop(); 68b4d2d410SLiu Zhe app.start(); 69faa4b864SLei De Bin } 709edf8282SLiu Zhe 7132c31156SLiu Zhe 7291745ed9SLiu Zhe @Test 7391745ed9SLiu Zhe public void smokeTest() { 7491745ed9SLiu Zhe File smoketestOutput = new File(aoo.getUserInstallation(), "user/temp"); 75a622bb93SDamjan Jovanovic File testDir = getFile().getParentFile(); 76a622bb93SDamjan Jovanovic File smokeTestDir = new File(testDir, "smoketestdoc"); 77a622bb93SDamjan Jovanovic File smokeTestTargetDir = new File(smokeTestDir, "target"); 78a622bb93SDamjan Jovanovic prepareData(new File(smokeTestTargetDir, "TestExtension.oxt").getAbsolutePath()); 7991745ed9SLiu Zhe // Open sample file smoketestdoc.sxw 80a622bb93SDamjan Jovanovic open(prepareData(new File(smokeTestTargetDir, "smoketestdoc.odt").getAbsolutePath())); 8191745ed9SLiu Zhe writer.waitForEnabled(10, 2); 8291745ed9SLiu Zhe // Run test cases 8391745ed9SLiu Zhe app.dispatch("vnd.sun.star.script:Standard.Global.StartTestWithDefaultOptions?language=Basic&location=document", 120); 8491745ed9SLiu Zhe String smoketestlog = FileUtil.readFileAsString(new File(smoketestOutput, "smoketest.log")); 8591745ed9SLiu Zhe String testclosurelog = FileUtil.readFileAsString(new File(smoketestOutput, "testclosure.log")); 8691745ed9SLiu Zhe log.info(smoketestlog + "\n" + testclosurelog); 8791745ed9SLiu Zhe assertTrue("No Error", !smoketestlog.contains("error") && !testclosurelog.contains("error")); 8891745ed9SLiu Zhe 8991745ed9SLiu Zhe } 9091745ed9SLiu Zhe 91faa4b864SLei De Bin @Test 9232c31156SLiu Zhe public void testExportAsPDF() throws Exception { 93b4d2d410SLiu Zhe String file = prepareData("bvt/pdf.odt"); 94b4d2d410SLiu Zhe String exportTo1 = getPath("temp/1.pdf"); 95b4d2d410SLiu Zhe String exportTo2 = getPath("temp/2.pdf"); 96b4d2d410SLiu Zhe deleteFile(exportTo1); 97b4d2d410SLiu Zhe deleteFile(exportTo2); 98b4d2d410SLiu Zhe open(file); 99b4d2d410SLiu Zhe writer.waitForExistence(10, 1); 100cb6199d5SLiu Zhe app.dispatch(".uno:ExportToPDF"); 101b4d2d410SLiu Zhe pdfGeneralPage.ok(); 102b4d2d410SLiu Zhe submitSaveDlg(exportTo1); 103b4d2d410SLiu Zhe sleep(1); 104b4d2d410SLiu Zhe String magic = FileUtil.readFileAsString(exportTo1).substring(0, 4); 105b4d2d410SLiu Zhe assertEquals("PDF is exported?", "%PDF", magic); 106b4d2d410SLiu Zhe 107b4d2d410SLiu Zhe button(".uno:ExportDirectToPDF").click();//Click via toolbar 108b4d2d410SLiu Zhe submitSaveDlg(exportTo2); 109b4d2d410SLiu Zhe sleep(1); 110b4d2d410SLiu Zhe magic = FileUtil.readFileAsString(exportTo2).substring(0, 4); 111b4d2d410SLiu Zhe assertEquals("PDF is exported directly?", "%PDF", magic); 112faa4b864SLei De Bin } 11332c31156SLiu Zhe 114faa4b864SLei De Bin /** 11532c31156SLiu Zhe * Test the File -- Print Dialog show 116faa4b864SLei De Bin * 11732c31156SLiu Zhe */ 118faa4b864SLei De Bin @Test 119b4d2d410SLiu Zhe public void testPrinter() { 12032c31156SLiu Zhe // Create a new text document 121b4d2d410SLiu Zhe newTextDocument(); 122b4d2d410SLiu Zhe app.dispatch(".uno:PrinterSetup"); 123b4d2d410SLiu Zhe if (activeMsgBox.exists(2)) 124b4d2d410SLiu Zhe activeMsgBox.ok(); 125b4d2d410SLiu Zhe 126b4d2d410SLiu Zhe // PrintService[] ps = PrintServiceLookup.lookupPrintServices(null, null); 127b4d2d410SLiu Zhe // String[] names = new String[ps.length]; 128b4d2d410SLiu Zhe // for (int i = 0; i < ps.length; i++) { 129b4d2d410SLiu Zhe // names[i] = ps[i].getName(); 130b4d2d410SLiu Zhe // } 131b4d2d410SLiu Zhe // 132b4d2d410SLiu Zhe // assertArrayEquals("Printers Names", names, printerSetUpDlgPrinterNames.getItemsText()); 133b4d2d410SLiu Zhe assertTrue("Printer Setup dialog appears", printerSetUpDlg.exists(3)); 134b4d2d410SLiu Zhe printerSetUpDlg.cancel(); 13532c31156SLiu Zhe } 13632c31156SLiu Zhe 137faa4b864SLei De Bin /** 13832c31156SLiu Zhe * Test the File -- Java Dialog show 139faa4b864SLei De Bin * 14032c31156SLiu Zhe */ 141b4d2d410SLiu Zhe // @Test 142b4d2d410SLiu Zhe // public void testJavaDialog() { 143b4d2d410SLiu Zhe // 144b4d2d410SLiu Zhe // // Create a new text document and launch a Wizards dialog which need JVM 145b4d2d410SLiu Zhe // // work correctly. 146b4d2d410SLiu Zhe // app.dispatch("private:factory/swriter"); 147b4d2d410SLiu Zhe // File tempfile = new File(oo.getUserInstallation(), "user/template/myAgendaTemplate.ott"); 148b4d2d410SLiu Zhe // FileUtil.deleteFile(tempfile); 149b4d2d410SLiu Zhe // sleep(3); 150b4d2d410SLiu Zhe // app.dispatch("service:com.sun.star.wizards.agenda.CallWizard?start"); 151b4d2d410SLiu Zhe // sleep(5); 152b4d2d410SLiu Zhe // assertTrue(Wizards_AgendaDialog.exists(10)); 153b4d2d410SLiu Zhe // Wizards_AgendaDialog_FinishButton.click(); 154b4d2d410SLiu Zhe // sleep(10); 155b4d2d410SLiu Zhe // writer.focus(); 156b4d2d410SLiu Zhe // sleep(1); 157b4d2d410SLiu Zhe // app.dispatch(".uno:SelectAll"); 158b4d2d410SLiu Zhe // typeKeys("<$copy>"); 159b4d2d410SLiu Zhe // // System.out.println("now txt:"+app.getClipboard()); 160b4d2d410SLiu Zhe // // assertTrue(app.getClipboard().startsWith("<Name>")); 161b4d2d410SLiu Zhe // assertNotNull(app.getClipboard()); 162b4d2d410SLiu Zhe // } 16332c31156SLiu Zhe 164faa4b864SLei De Bin /** 16532c31156SLiu Zhe * Test the Tools / Macros / Organize Dialogs" show 166faa4b864SLei De Bin * 16732c31156SLiu Zhe */ 168faa4b864SLei De Bin @Test 169b4d2d410SLiu Zhe public void testRunMacro() { 170b4d2d410SLiu Zhe open(prepareData("bvt/macro.ods")); 171b4d2d410SLiu Zhe calc.waitForExistence(10, 2); 172b4d2d410SLiu Zhe app.dispatch(".uno:RunMacro"); 173b4d2d410SLiu Zhe runMacroDlgCategories.expand("macro.ods"); 174b4d2d410SLiu Zhe runMacroDlgCategories.expand("Standard"); 175b4d2d410SLiu Zhe runMacroDlgCategories.select("Module1"); 176b4d2d410SLiu Zhe runMacroDlgCommands.select(0); 177b4d2d410SLiu Zhe runMacroDlg.ok(); 178495a0bcaSCarl Marcum sleep(1); 179b4d2d410SLiu Zhe assertEquals("A3 should be =1+3", "4", SCTool.getCellText("A3")); 180b4d2d410SLiu Zhe discard(); 181faa4b864SLei De Bin } 18232c31156SLiu Zhe 183faa4b864SLei De Bin /** 18432c31156SLiu Zhe * Test the About Dialog show 185faa4b864SLei De Bin * 18632c31156SLiu Zhe */ 187faa4b864SLei De Bin @Test 188b4d2d410SLiu Zhe public void testHelp() { 189cb6199d5SLiu Zhe app.dispatch(".uno:About"); 190b4d2d410SLiu Zhe assertTrue(aboutDialog.exists(5)); 191b4d2d410SLiu Zhe aboutDialog.ok(); 192b4d2d410SLiu Zhe sleep(1); 193b4d2d410SLiu Zhe typeKeys("<F1>"); 194b4d2d410SLiu Zhe assertTrue(helpWindow.exists(5)); 195b4d2d410SLiu Zhe helpWindow.close(); 196faa4b864SLei De Bin } 19732c31156SLiu Zhe 198faa4b864SLei De Bin /** 199faa4b864SLei De Bin * Test inserting a picture in text document 20032c31156SLiu Zhe * 201faa4b864SLei De Bin * @throws Exception 202faa4b864SLei De Bin */ 20332c31156SLiu Zhe 204faa4b864SLei De Bin @Test 205faa4b864SLei De Bin public void testInsertPictureInDocument() throws Exception { 2066b55ece7SLiu Zhe String bmp_green = prepareData("image/green_256x256.bmp"); 2076b55ece7SLiu Zhe String bmp_red = prepareData("image/red_256x256.bmp"); 20832c31156SLiu Zhe 20932c31156SLiu Zhe // Create a new text document 210b4d2d410SLiu Zhe newTextDocument(); 21132c31156SLiu Zhe // Insert a picture fully filled with green 21232c31156SLiu Zhe app.dispatch(".uno:InsertGraphic"); 213faa4b864SLei De Bin submitOpenDlg(bmp_green); 214b4d2d410SLiu Zhe writer.click(5,200); 215faa4b864SLei De Bin sleep(1); 21632c31156SLiu Zhe 217faa4b864SLei De Bin // Verify if the picture is inserted successfully 21822a14f28SLiu Zhe Rectangle rectangle = GraphicsUtil.findRectangle(writer.getScreenRectangle(), 0xFF00FF00); 219b4d2d410SLiu Zhe assertTrue("Green Picture is inserted?" + rectangle, rectangle != null && rectangle.getWidth() > 10); 22032c31156SLiu Zhe // insert another picture 22132c31156SLiu Zhe app.dispatch(".uno:InsertGraphic"); 222faa4b864SLei De Bin submitOpenDlg(bmp_red); 223b4d2d410SLiu Zhe writer.click(5, 200); 224faa4b864SLei De Bin sleep(1); 225faa4b864SLei De Bin // Verify if the picture is inserted successfully 22622a14f28SLiu Zhe rectangle = GraphicsUtil.findRectangle(writer.getScreenRectangle(), 0xFFFF0000); 227b4d2d410SLiu Zhe assertTrue("Green Picture is inserted? " + rectangle, rectangle != null && rectangle.getWidth() > 10); 228b4d2d410SLiu Zhe discard(); 229faa4b864SLei De Bin } 230faa4b864SLei De Bin 231faa4b864SLei De Bin @Test 232faa4b864SLei De Bin public void testInsertPictureInSpreadsheet() throws Exception { 233b4d2d410SLiu Zhe String bmp_green = prepareData("image/green_64x64.png"); 234b4d2d410SLiu Zhe String bmp_red = prepareData("image/red_64x64.png"); 235b4d2d410SLiu Zhe newSpreadsheet(); 23632c31156SLiu Zhe // Insert a picture fully filled with green 23732c31156SLiu Zhe app.dispatch(".uno:InsertGraphic"); 238faa4b864SLei De Bin submitOpenDlg(bmp_green); 239b4d2d410SLiu Zhe calc.click(5, 150); 240faa4b864SLei De Bin sleep(1); 24132c31156SLiu Zhe 242faa4b864SLei De Bin // Verify if the picture is inserted successfully 24322a14f28SLiu Zhe Rectangle rectangle = GraphicsUtil.findRectangle(calc.getScreenRectangle(), 0xFF00FF00); 244b4d2d410SLiu Zhe assertTrue("Green Picture is inserted?" + rectangle, rectangle != null && rectangle.getWidth() > 10); 245b4d2d410SLiu Zhe 246b4d2d410SLiu Zhe SCTool.selectRange("C1"); 24732c31156SLiu Zhe // insert another picture 24832c31156SLiu Zhe app.dispatch(".uno:InsertGraphic"); 249faa4b864SLei De Bin submitOpenDlg(bmp_red); 250b4d2d410SLiu Zhe calc.click(5, 150); 251faa4b864SLei De Bin sleep(1); 252faa4b864SLei De Bin // Verify if the picture is inserted successfully 25322a14f28SLiu Zhe rectangle = GraphicsUtil.findRectangle(calc.getScreenRectangle(), 0xFFFF0000); 254b4d2d410SLiu Zhe assertTrue("Red Picture is inserted? " + rectangle, rectangle != null && rectangle.getWidth() > 10); 255b4d2d410SLiu Zhe discard(); 256faa4b864SLei De Bin } 25732c31156SLiu Zhe 258faa4b864SLei De Bin @Test 259faa4b864SLei De Bin public void testInsertPictureInPresentation() throws Exception { 2606b55ece7SLiu Zhe String bmp_green = prepareData("image/green_256x256.bmp"); 2616b55ece7SLiu Zhe String bmp_red = prepareData("image/red_256x256.bmp"); 262b4d2d410SLiu Zhe newPresentation(); 26332c31156SLiu Zhe // Insert a picture fully filled with green 26432c31156SLiu Zhe app.dispatch(".uno:InsertGraphic"); 265faa4b864SLei De Bin submitOpenDlg(bmp_green); 26632c31156SLiu Zhe impress.click(5, 5); 267faa4b864SLei De Bin sleep(1); 26832c31156SLiu Zhe 269faa4b864SLei De Bin // Verify if the picture is inserted successfully 27022a14f28SLiu Zhe Rectangle rectangle = GraphicsUtil.findRectangle(impress.getScreenRectangle(), 0xFF00FF00); 271b4d2d410SLiu Zhe assertTrue("Green Picture is inserted?" + rectangle, rectangle != null && rectangle.getWidth() > 10); 27232c31156SLiu Zhe // insert another picture 27332c31156SLiu Zhe app.dispatch(".uno:InsertGraphic"); 274faa4b864SLei De Bin submitOpenDlg(bmp_red); 275faa4b864SLei De Bin impress.click(1, 1); 276faa4b864SLei De Bin sleep(1); 277faa4b864SLei De Bin // Verify if the picture is inserted successfully 27822a14f28SLiu Zhe rectangle = GraphicsUtil.findRectangle(impress.getScreenRectangle(), 0xFFFF0000); 279b4d2d410SLiu Zhe assertTrue("Red Picture is inserted? " + rectangle, rectangle != null && rectangle.getWidth() > 10); 280b4d2d410SLiu Zhe discard(); 281faa4b864SLei De Bin } 28232c31156SLiu Zhe 283faa4b864SLei De Bin @Test 284faa4b864SLei De Bin public void testSlideShow() throws Exception { 285b4d2d410SLiu Zhe open(prepareData("bvt/slideshow.odp")); 286faa4b864SLei De Bin impress.waitForExistence(10, 2); 287b4d2d410SLiu Zhe sleep(1); 288b4d2d410SLiu Zhe impress.typeKeys("<F5>"); 289faa4b864SLei De Bin sleep(3); 290b4d2d410SLiu Zhe Rectangle rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFFFF0000); 291faa4b864SLei De Bin assertNotNull("1st slide appears", rectangle); 292b4d2d410SLiu Zhe slideShow.click(0.5, 0.5); 293faa4b864SLei De Bin sleep(2); 294b4d2d410SLiu Zhe rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFF00FF00); 295faa4b864SLei De Bin assertNotNull("2nd slide appears", rectangle); 296faa4b864SLei De Bin typeKeys("<enter>"); 297faa4b864SLei De Bin sleep(2); 298b4d2d410SLiu Zhe rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFF0000FF); 299faa4b864SLei De Bin assertNotNull("3rd slide appears", rectangle); 300b4d2d410SLiu Zhe slideShow.click(0.5, 0.5); 301faa4b864SLei De Bin sleep(2); 302b4d2d410SLiu Zhe rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFF0000FF); 303faa4b864SLei De Bin assertNull("The end", rectangle); 304b4d2d410SLiu Zhe slideShow.click(0.5, 0.5); 305faa4b864SLei De Bin sleep(3); 306b4d2d410SLiu Zhe assertFalse("Quit", slideShow.exists()); 307faa4b864SLei De Bin } 30832c31156SLiu Zhe 309faa4b864SLei De Bin @Test 310faa4b864SLei De Bin public void testFind() { 311b4d2d410SLiu Zhe open(prepareData("bvt/find.odt")); 312faa4b864SLei De Bin writer.waitForExistence(10, 2); 31332c31156SLiu Zhe app.dispatch(".uno:SearchDialog"); 314b4d2d410SLiu Zhe findDlgFor.setText("OpenOffice"); 315b4d2d410SLiu Zhe findDlgFind.click(); 316faa4b864SLei De Bin sleep(1); 317b4d2d410SLiu Zhe writer.typeKeys("<$copy>"); 318faa4b864SLei De Bin assertEquals("OpenOffice", app.getClipboard()); 319b4d2d410SLiu Zhe findDlgFindAll.click(); 320faa4b864SLei De Bin sleep(1); 321b4d2d410SLiu Zhe writer.typeKeys("<$copy>"); 322faa4b864SLei De Bin assertEquals("OpenOfficeOpenOfficeOpenOffice", app.getClipboard()); 323b4d2d410SLiu Zhe findDlgReplaceWith.setText("Awesome OpenOffice"); 324b4d2d410SLiu Zhe findDlgReplaceAll.click(); 325faa4b864SLei De Bin sleep(1); 326faa4b864SLei De Bin msgbox("Search key replaced 3 times.").ok(); 327b4d2d410SLiu Zhe findDlg.close(); 328faa4b864SLei De Bin sleep(1); 32932c31156SLiu Zhe assertEquals( 33032c31156SLiu 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. ", 331b4d2d410SLiu Zhe copyAll()); 332bf385f73SDamjan Jovanovic discard(); 333faa4b864SLei De Bin } 3342e4d2335SDamjan Jovanovic 3352e4d2335SDamjan Jovanovic @Test 3362e4d2335SDamjan Jovanovic public void testFindFormulasAndValues() { 3372e4d2335SDamjan Jovanovic open(prepareData("bvt/searchFormulasValues.ods")); 3382e4d2335SDamjan Jovanovic calc.waitForExistence(10, 2); 3392e4d2335SDamjan Jovanovic 3402e4d2335SDamjan Jovanovic // Searching for 2003 by formula finds A2 3412e4d2335SDamjan Jovanovic SCTool.selectRange("A1"); 3422e4d2335SDamjan Jovanovic app.dispatch(".uno:SearchDialog"); 3432e4d2335SDamjan Jovanovic findDlgFor.setText("2003"); 3442e4d2335SDamjan Jovanovic findDlgMore.click(); 3452e4d2335SDamjan Jovanovic findDlgCalcSearchIn.select("Formulas"); 3462e4d2335SDamjan Jovanovic findDlgFind.click(); 3472e4d2335SDamjan Jovanovic sleep(1); 3482e4d2335SDamjan Jovanovic assertEquals("wrong cell found for formulas search", "A2", scInputBarPosition.getText()); 3492e4d2335SDamjan Jovanovic findDlg.close(); 3502e4d2335SDamjan Jovanovic 3512e4d2335SDamjan Jovanovic // Searching for October by value finds A2 3522e4d2335SDamjan Jovanovic SCTool.selectRange("A1"); 3532e4d2335SDamjan Jovanovic app.dispatch(".uno:SearchDialog"); 3542e4d2335SDamjan Jovanovic findDlgFor.setText("October"); 3552e4d2335SDamjan Jovanovic findDlgMore.click(); 3562e4d2335SDamjan Jovanovic findDlgCalcSearchIn.select("Values"); 3572e4d2335SDamjan Jovanovic findDlgFind.click(); 3582e4d2335SDamjan Jovanovic sleep(1); 3592e4d2335SDamjan Jovanovic assertEquals("wrong cell found for values search", "A2", scInputBarPosition.getText()); 3602e4d2335SDamjan Jovanovic findDlg.close(); 3612e4d2335SDamjan Jovanovic 3622e4d2335SDamjan Jovanovic discard(); 3632e4d2335SDamjan Jovanovic } 36432c31156SLiu Zhe 365faa4b864SLei De Bin @Test 366faa4b864SLei De Bin public void testFillInSpreadsheet() { 36722a14f28SLiu Zhe String[][] expected1 = new String[][] { { "1" }, { "1" }, { "1" }, { "1" }, { "1" }, { "1" }, }; 36822a14f28SLiu Zhe String[][] expected2 = new String[][] { { "2" }, { "2" }, { "2" }, { "2" }, { "2" }, { "2" }, }; 36922a14f28SLiu Zhe String[][] expected3 = new String[][] { { "Hi friends", "Hi friends", "Hi friends", "Hi friends" } }; 37022a14f28SLiu Zhe String[][] expected4 = new String[][] { { "99999.999", "99999.999", "99999.999", "99999.999" } }; 371faa4b864SLei De Bin String[][] expected5 = new String[][] { 37222a14f28SLiu Zhe { "99999.999", "-10" }, { "100000.999", "-9" }, { "100001.999", "-8" }, { "100002.999", "-7" }, { "100003.999", "-6" } 373faa4b864SLei De Bin }; 374b4d2d410SLiu Zhe newSpreadsheet(); 375b4d2d410SLiu Zhe SCTool.selectRange("C5"); 376faa4b864SLei De Bin typeKeys("1<enter>"); 377b4d2d410SLiu Zhe SCTool.selectRange("C5:C10"); 37832c31156SLiu Zhe app.dispatch(".uno:FillDown"); 379b4d2d410SLiu Zhe assertArrayEquals("Fill Down:", expected1, SCTool.getCellTexts("C5:C10")); 38032c31156SLiu Zhe 381b4d2d410SLiu Zhe SCTool.selectRange("D10"); 382faa4b864SLei De Bin typeKeys("2<enter>"); 383b4d2d410SLiu Zhe SCTool.selectRange("D5:D10"); 38432c31156SLiu Zhe app.dispatch(".uno:FillUp"); 385b4d2d410SLiu Zhe assertArrayEquals("Fill Up:", expected2, SCTool.getCellTexts("D5:D10")); 38632c31156SLiu Zhe 387b4d2d410SLiu Zhe SCTool.selectRange("A1"); 388faa4b864SLei De Bin typeKeys("Hi friends<enter>"); 389b4d2d410SLiu Zhe SCTool.selectRange("A1:D1"); 39032c31156SLiu Zhe app.dispatch(".uno:FillRight"); 391b4d2d410SLiu Zhe assertArrayEquals("Fill Right:", expected3, SCTool.getCellTexts("A1:D1")); 39232c31156SLiu Zhe 393b4d2d410SLiu Zhe SCTool.selectRange("D2"); 394faa4b864SLei De Bin typeKeys("99999.999<enter>"); 395b4d2d410SLiu Zhe SCTool.selectRange("A2:D2"); 39632c31156SLiu Zhe app.dispatch(".uno:FillLeft"); 397b4d2d410SLiu Zhe assertArrayEquals("Fill left:", expected4, SCTool.getCellTexts("A2:D2")); 398faa4b864SLei De Bin 399b4d2d410SLiu Zhe SCTool.selectRange("E1"); 400faa4b864SLei De Bin typeKeys("99999.999<tab>-10<enter>"); 40132c31156SLiu Zhe 402b4d2d410SLiu Zhe SCTool.selectRange("E1:F5"); 40332c31156SLiu Zhe app.dispatch(".uno:FillSeries"); 404b4d2d410SLiu Zhe fillSeriesDlg.ok(); 405faa4b864SLei De Bin sleep(1); 406b4d2d410SLiu Zhe assertArrayEquals("Fill series..", expected5, SCTool.getCellTexts("E1:F5")); 407b4d2d410SLiu Zhe discard(); 408faa4b864SLei De Bin } 40932c31156SLiu Zhe 410faa4b864SLei De Bin @Test 411faa4b864SLei De Bin public void testSort() { 41222a14f28SLiu Zhe String[][] expected1 = new String[][] { { "-9999999" }, { "-1.1" }, { "-1.1" }, { "0" }, { "0" }, { "0.1" }, { "10" }, { "12" }, { "9999999" }, { "9999999" }, 413faa4b864SLei De Bin 414faa4b864SLei De Bin }; 41522a14f28SLiu Zhe String[][] expected2 = new String[][] { { "TRUE", "Oracle" }, { "TRUE", "OpenOffice" }, { "FALSE", "OpenOffice" }, { "TRUE", "IBM" }, { "FALSE", "IBM" }, 41622a14f28SLiu Zhe { "TRUE", "Google" }, { "FALSE", "facebook " }, { "TRUE", "Apache" }, { "TRUE", "!yahoo" }, { "TRUE", "" }, 417faa4b864SLei De Bin 418faa4b864SLei De Bin }; 419faa4b864SLei De Bin 42022a14f28SLiu Zhe String[][] expected3 = new String[][] { { "Sunday" }, { "Monday" }, { "Tuesday" }, { "Wednesday" }, { "Thursday" }, { "Friday" }, { "Saturday" }, 421faa4b864SLei De Bin 422faa4b864SLei De Bin }; 42332c31156SLiu Zhe 42422a14f28SLiu Zhe String[][] expected4 = new String[][] { { "-$10.00" }, { "$0.00" }, { "$0.00" }, { "$1.00" }, { "$3.00" }, { "$9.00" }, { "$123.00" }, { "$200.00" }, { "$400.00" }, 42522a14f28SLiu Zhe { "$10,000.00" }, 426faa4b864SLei De Bin 427faa4b864SLei De Bin }; 428b4d2d410SLiu Zhe open(prepareData("bvt/sort.ods")); 429faa4b864SLei De Bin calc.waitForExistence(10, 2); 430b4d2d410SLiu Zhe SCTool.selectRange("A1:A10"); 431cb6199d5SLiu Zhe app.dispatch(".uno:DataSort"); 432b4d2d410SLiu Zhe sortWarningDlgCurrent.click(); 433b4d2d410SLiu Zhe assertEquals(1, sortPageBy1.getSelIndex()); 434b4d2d410SLiu Zhe sortPage.ok(); 435faa4b864SLei De Bin sleep(1); 436b4d2d410SLiu Zhe assertArrayEquals("Sorted Data", expected1, SCTool.getCellTexts("A1:A10")); 437b4d2d410SLiu Zhe SCTool.selectRange("B1:C10"); 438cb6199d5SLiu Zhe app.dispatch(".uno:DataSort"); 4397dd7871fSLei De Bin 440b4d2d410SLiu Zhe sortPageBy1.select(2); 441b4d2d410SLiu Zhe sortPageDescending1.check(); 442b4d2d410SLiu Zhe assertFalse(sortPageBy3.isEnabled()); 443b4d2d410SLiu Zhe assertFalse(sortPageAscending3.isEnabled()); 444b4d2d410SLiu Zhe assertFalse(sortPageDescending3.isEnabled()); 445b4d2d410SLiu Zhe sortPageBy2.select(1); 446b4d2d410SLiu Zhe assertTrue(sortPageBy3.isEnabled()); 447b4d2d410SLiu Zhe assertTrue(sortPageAscending3.isEnabled()); 448b4d2d410SLiu Zhe assertTrue(sortPageDescending3.isEnabled()); 449b4d2d410SLiu Zhe sortPageDescending2.check(); 450b4d2d410SLiu Zhe sortPageBy2.select(0); 451b4d2d410SLiu Zhe assertFalse(sortPageBy3.isEnabled()); 452b4d2d410SLiu Zhe assertFalse(sortPageAscending3.isEnabled()); 453b4d2d410SLiu Zhe assertFalse(sortPageDescending3.isEnabled()); 454b4d2d410SLiu Zhe sortPageBy2.select(1); 455b4d2d410SLiu Zhe sortPage.ok(); 456faa4b864SLei De Bin sleep(1); 45732c31156SLiu Zhe 458b4d2d410SLiu Zhe assertArrayEquals("Sorted Data", expected2, SCTool.getCellTexts("B1:C10")); 459b4d2d410SLiu Zhe SCTool.selectRange("D1:D7"); 460cb6199d5SLiu Zhe app.dispatch(".uno:DataSort"); 461b4d2d410SLiu Zhe sortWarningDlgCurrent.click(); 462b4d2d410SLiu Zhe sortOptionsPage.select(); 463b4d2d410SLiu Zhe sortOptionsPageRangeContainsColumnLabels.uncheck(); 464b4d2d410SLiu Zhe sortOptionsPageCustomSortOrder.check(); 465b4d2d410SLiu Zhe sortOptionsPageCustomSortOrderList.select("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"); 466b4d2d410SLiu Zhe sortOptionsPage.ok(); 467faa4b864SLei De Bin sleep(1); 468b4d2d410SLiu Zhe assertArrayEquals("Sorted Data", expected3, SCTool.getCellTexts("D1:D7")); 46932c31156SLiu Zhe 470b4d2d410SLiu Zhe SCTool.selectRange("E1:E10"); 471cb6199d5SLiu Zhe app.dispatch(".uno:DataSort"); 472b4d2d410SLiu Zhe sortWarningDlgCurrent.click(); 473b4d2d410SLiu Zhe sortPage.ok(); 474faa4b864SLei De Bin sleep(1); 475b4d2d410SLiu Zhe assertArrayEquals("Sorted Data", expected4, SCTool.getCellTexts("E1:E10")); 476b4d2d410SLiu Zhe discard(); 477faa4b864SLei De Bin } 47832c31156SLiu Zhe 4797dd2b5bbSLiu Zhe /** 48032c31156SLiu Zhe * Test insert a chart in a draw document 1. New a draw document 2. Insert a 48132c31156SLiu Zhe * chart 3. Check if the chart is inserted successfully 48232c31156SLiu Zhe * 4837dd2b5bbSLiu Zhe * @throws Exception 4847dd2b5bbSLiu Zhe */ 4857dd2b5bbSLiu Zhe @Test 48632c31156SLiu Zhe public void testInsertChartInDraw() throws Exception { 4877dd2b5bbSLiu Zhe // Create a new drawing document 488b4d2d410SLiu Zhe newDrawing(); 4897dd2b5bbSLiu Zhe // Insert a chart 49032c31156SLiu Zhe app.dispatch(".uno:InsertObjectChart"); 4917dd2b5bbSLiu Zhe sleep(3); 49232c31156SLiu Zhe 4937dd2b5bbSLiu Zhe // Verify if the chart is inserted successfully 494b4d2d410SLiu Zhe assertTrue("Chart Editor appears", chart.exists(3)); 4957dd2b5bbSLiu Zhe // Focus on edit pane 49632c31156SLiu Zhe draw.click(5, 5); 4977dd2b5bbSLiu Zhe sleep(1); 498b4d2d410SLiu Zhe assertFalse("Chart Editor appears", chart.exists()); 499b4d2d410SLiu Zhe discard(); 5007dd2b5bbSLiu Zhe } 50132c31156SLiu Zhe 5027dd2b5bbSLiu Zhe /** 50332c31156SLiu Zhe * Test insert a chart in a text document 1. New a text document 2. Insert a 50432c31156SLiu Zhe * chart 3. Check if the chart is inserted successfully 50532c31156SLiu Zhe * 5067dd2b5bbSLiu Zhe * @throws Exception 5077dd2b5bbSLiu Zhe */ 5087dd2b5bbSLiu Zhe @Test 50932c31156SLiu Zhe public void testInsertChartInDocument() throws Exception { 5107dd2b5bbSLiu Zhe // Create a new text document 511b4d2d410SLiu Zhe newTextDocument(); 5127dd2b5bbSLiu Zhe // Insert a chart 51332c31156SLiu Zhe app.dispatch(".uno:InsertObjectChart"); 5147dd2b5bbSLiu Zhe sleep(3); 51532c31156SLiu Zhe 5167dd2b5bbSLiu Zhe // Verify if the chart is inserted successfully 517b4d2d410SLiu Zhe assertTrue("Chart Editor appears", chart.exists(3)); 5187dd2b5bbSLiu Zhe // Focus on edit pane 51932c31156SLiu Zhe writer.click(5, 5); 5207dd2b5bbSLiu Zhe sleep(1); 521b4d2d410SLiu Zhe assertFalse("Chart Editor appears", chart.exists()); 522b4d2d410SLiu Zhe discard(); 5237dd2b5bbSLiu Zhe } 52432c31156SLiu Zhe 5257dd2b5bbSLiu Zhe /** 52632c31156SLiu Zhe * Test insert a chart in a spreadsheet document 1. New a spreadsheet 52732c31156SLiu Zhe * document 2. Insert a chart 3. Check if the chart is inserted successfully 52832c31156SLiu Zhe * 5297dd2b5bbSLiu Zhe * @throws Exception 5307dd2b5bbSLiu Zhe */ 5317dd2b5bbSLiu Zhe @Test 53232c31156SLiu Zhe public void testInsertChartInSpreadsheet() throws Exception { 5337dd2b5bbSLiu Zhe // Create a new spreadsheet document 534b4d2d410SLiu Zhe newSpreadsheet(); 5357dd2b5bbSLiu Zhe // Insert a chart 53632c31156SLiu Zhe app.dispatch(".uno:InsertObjectChart"); 5377dd2b5bbSLiu Zhe sleep(3); 538b4d2d410SLiu Zhe chartWizard.ok(); 53932c31156SLiu Zhe 5407dd2b5bbSLiu Zhe // Verify if the chart is inserted successfully 541b4d2d410SLiu Zhe assertTrue("Chart Editor appears", chart.exists(3)); 5427dd2b5bbSLiu Zhe // Focus on edit pane 54332c31156SLiu Zhe calc.click(5, 5); 54432c31156SLiu Zhe sleep(1); 545b4d2d410SLiu Zhe assertFalse("Chart Editor appears", chart.exists()); 546b4d2d410SLiu Zhe discard(); 5477dd2b5bbSLiu Zhe } 54832c31156SLiu Zhe 5497dd2b5bbSLiu Zhe /** 55032c31156SLiu Zhe * Test insert a chart in a presentation document 1. New a presentation 55132c31156SLiu Zhe * document 2. Insert a chart 3. Check if the chart is inserted successfully 55232c31156SLiu Zhe * 5537dd2b5bbSLiu Zhe * @throws Exception 5547dd2b5bbSLiu Zhe */ 5552aaec72aSLiu Zhe @Test 55632c31156SLiu Zhe public void testInsertChartInPresentation() throws Exception { 5577dd2b5bbSLiu Zhe // Create a new presentation document 558b4d2d410SLiu Zhe newPresentation(); 5597dd2b5bbSLiu Zhe // Insert a chart 56032c31156SLiu Zhe app.dispatch(".uno:InsertObjectChart"); 5617dd2b5bbSLiu Zhe sleep(3); 5627dd2b5bbSLiu Zhe // Verify if the chart is inserted successfully 563b4d2d410SLiu Zhe assertTrue("Chart Editor appears", chart.exists(3)); 5647dd2b5bbSLiu Zhe // Focus on edit pane 56532c31156SLiu Zhe impress.click(5, 5); 56632c31156SLiu Zhe sleep(1); 567b4d2d410SLiu Zhe assertFalse("Chart Editor appears", chart.exists()); 568b4d2d410SLiu Zhe discard(); 5697dd2b5bbSLiu Zhe } 57032c31156SLiu Zhe 5717dd2b5bbSLiu Zhe /** 57232c31156SLiu Zhe * Test insert a table in a draw document 1. New a draw document 2. Insert a 57332c31156SLiu Zhe * default table 3. Check if the table is inserted successfully 57432c31156SLiu Zhe * 5757dd2b5bbSLiu Zhe * @throws Exception 5767dd2b5bbSLiu Zhe */ 5777dd2b5bbSLiu Zhe @Test 57832c31156SLiu Zhe public void testInsertTableInDraw() throws Exception { 5797dd2b5bbSLiu Zhe // Create a new drawing document 580b4d2d410SLiu Zhe newDrawing(); 5817dd2b5bbSLiu Zhe // Insert a table 58232c31156SLiu Zhe app.dispatch(".uno:InsertTable"); 583b4d2d410SLiu Zhe insertTable.ok(); 5847dd2b5bbSLiu Zhe sleep(1); 585b4d2d410SLiu Zhe draw.typeKeys("3"); 586b4d2d410SLiu Zhe assertTrue("Table Toolbar appears", tableToolbar.exists(3)); 587b4d2d410SLiu Zhe // assertEquals("The cell content", "3", copyAll()); 588b4d2d410SLiu Zhe discard(); 5897dd2b5bbSLiu Zhe } 59032c31156SLiu Zhe 5917dd2b5bbSLiu Zhe /** 59232c31156SLiu Zhe * Test insert a table in a text document 1. New a text document 2. Insert a 59332c31156SLiu Zhe * default table 3. Check if the table is inserted successfully 59432c31156SLiu Zhe * 5957dd2b5bbSLiu Zhe * @throws Exception 5967dd2b5bbSLiu Zhe */ 5977dd2b5bbSLiu Zhe @Test 59832c31156SLiu Zhe public void testInsertTableInDocument() throws Exception { 5997dd2b5bbSLiu Zhe // Create a new text document 600b4d2d410SLiu Zhe newTextDocument(); 6017dd2b5bbSLiu Zhe // Insert a table 60232c31156SLiu Zhe app.dispatch(".uno:InsertTable"); 603b4d2d410SLiu Zhe writerInsertTable.ok(); 6047dd2b5bbSLiu Zhe sleep(1); 605b4d2d410SLiu Zhe writer.typeKeys("3"); 606b4d2d410SLiu Zhe // Verify if the table toolbar is active 607b4d2d410SLiu Zhe assertTrue("Table Toolbar appears", tableToolbar.exists(3)); 608b4d2d410SLiu Zhe // assertEquals("The cell content", "3", copyAll()); 609b4d2d410SLiu Zhe discard(); 6107dd2b5bbSLiu Zhe } 61132c31156SLiu Zhe 6127dd2b5bbSLiu Zhe /** 61332c31156SLiu Zhe * Test insert a table in a presentation document 1. New a presentation 61432c31156SLiu Zhe * document 2. Insert a default table 3. Check if the table is inserted 61532c31156SLiu Zhe * successfully 61632c31156SLiu Zhe * 6177dd2b5bbSLiu Zhe * @throws Exception 6187dd2b5bbSLiu Zhe */ 6197dd2b5bbSLiu Zhe @Test 62032c31156SLiu Zhe public void testInsertTableInPresentation() throws Exception { 6217dd2b5bbSLiu Zhe // Create a new presentation document 622b4d2d410SLiu Zhe newPresentation(); 62332c31156SLiu Zhe 6247dd2b5bbSLiu Zhe // Insert a table 62532c31156SLiu Zhe app.dispatch(".uno:InsertTable"); 626b4d2d410SLiu Zhe insertTable.ok(); 6277dd2b5bbSLiu Zhe sleep(1); 628b4d2d410SLiu Zhe impress.typeKeys("3"); 629b4d2d410SLiu Zhe assertTrue("Table Toolbar appears", tableToolbar.exists(3)); 630b4d2d410SLiu Zhe // assertEquals("The cell content", "3", copyAll()); 631b4d2d410SLiu Zhe discard(); 6327dd2b5bbSLiu Zhe } 6337dd2b5bbSLiu Zhe 6347dd2b5bbSLiu Zhe /** 63532c31156SLiu Zhe * Test insert a function in a spreadsheet document via Sum button 1. New a 63632c31156SLiu Zhe * spreadsheet document 2. Insert a function via Sum button 3. Check if the 63732c31156SLiu Zhe * result is correct 63832c31156SLiu Zhe * 6397dd2b5bbSLiu Zhe * @throws Exception 6407dd2b5bbSLiu Zhe */ 6417dd2b5bbSLiu Zhe @Test 642b4d2d410SLiu Zhe public void testSumInFormulaBar() throws Exception { 6437dd2b5bbSLiu Zhe // Create a new spreadsheet document 644b4d2d410SLiu Zhe newSpreadsheet(); 6457dd2b5bbSLiu Zhe // Insert source numbers 6467dd2b5bbSLiu Zhe String sourceNumber1 = "5"; 6477dd2b5bbSLiu Zhe String sourceNumber2 = "3"; 6487dd2b5bbSLiu Zhe String expectedResult = "8"; 649b4d2d410SLiu Zhe SCTool.selectRange("A1"); 6507dd2b5bbSLiu Zhe typeKeys(sourceNumber1); 651b4d2d410SLiu Zhe SCTool.selectRange("B1"); 65232c31156SLiu Zhe typeKeys(sourceNumber2); 6537dd2b5bbSLiu Zhe // Insert a function via Sum button 654b4d2d410SLiu Zhe SCTool.selectRange("C1"); 655b4d2d410SLiu Zhe scInputBarSum.click(); 6567dd2b5bbSLiu Zhe typeKeys("<enter>"); 6577dd2b5bbSLiu Zhe // Verify if the calculated result is equal to the expected result 658b4d2d410SLiu Zhe assertEquals("The calculated result", expectedResult, SCTool.getCellText("C1")); 659b4d2d410SLiu Zhe discard(); 6607dd2b5bbSLiu Zhe } 66132c31156SLiu Zhe 6627dd2b5bbSLiu Zhe /** 66332c31156SLiu Zhe * Test insert a function in a spreadsheet document via inputbar 1. New a 66432c31156SLiu Zhe * spreadsheet document 2. Insert a function via inputbar: COS 3. Check if 66532c31156SLiu Zhe * the result is correct 66632c31156SLiu Zhe * 6677dd2b5bbSLiu Zhe * @throws Exception 6687dd2b5bbSLiu Zhe */ 6697dd2b5bbSLiu Zhe @Test 670b4d2d410SLiu Zhe public void testInsertFunctionViaFormulaBar() throws Exception { 6717dd2b5bbSLiu Zhe // Create a new spreadsheet document 672b4d2d410SLiu Zhe newSpreadsheet(); 6737dd2b5bbSLiu Zhe // Insert source numbers and expected result 67432c31156SLiu Zhe String sourceData = "0"; 67532c31156SLiu Zhe String expectedResult = "1"; 676b4d2d410SLiu Zhe SCTool.selectRange("A1"); 67732c31156SLiu Zhe typeKeys(sourceData); 67832c31156SLiu Zhe 67932c31156SLiu Zhe // Insert a function via inputbar: COS 680b4d2d410SLiu Zhe SCTool.selectRange("D1"); 681b4d2d410SLiu Zhe scInputBarInput.inputKeys("=COS(A1)"); 6827dd2b5bbSLiu Zhe typeKeys("<enter>"); 683495a0bcaSCarl Marcum sleep(1); 6847dd2b5bbSLiu Zhe // Verify if the calculated result is equal to the expected result 685495a0bcaSCarl Marcum String result = SCTool.getCellText("D1"); 686495a0bcaSCarl Marcum sleep(1); 687495a0bcaSCarl Marcum assertEquals("The calculated result", expectedResult, result); 688b4d2d410SLiu Zhe discard(); 6897dd2b5bbSLiu Zhe } 69032c31156SLiu Zhe 6917dd2b5bbSLiu Zhe /** 69232c31156SLiu Zhe * Test insert a function in a spreadsheet document via Function Wizard 69332c31156SLiu Zhe * Dialog 1. New a spreadsheet document 2. Insert a function via Function 69432c31156SLiu Zhe * Wizard Dialog: ABS 3. Check if the result is correct 69532c31156SLiu Zhe * 6967dd2b5bbSLiu Zhe * @throws Exception 6977dd2b5bbSLiu Zhe */ 6987dd2b5bbSLiu Zhe @Test 699b4d2d410SLiu Zhe public void testFunctionWizardInFormulaBar() throws Exception { 7007dd2b5bbSLiu Zhe // Create a new spreadsheet document 701b4d2d410SLiu Zhe newSpreadsheet(); 7027dd2b5bbSLiu Zhe // Insert source number 7037dd2b5bbSLiu Zhe String sourceNumber = "-5"; 7047dd2b5bbSLiu Zhe String expectedResult = "5"; 705b4d2d410SLiu Zhe SCTool.selectRange("A1"); 7067dd2b5bbSLiu Zhe typeKeys(sourceNumber); 7077dd2b5bbSLiu Zhe typeKeys("<enter>"); 7087dd2b5bbSLiu Zhe // Insert a function via Function Wizard Dialog: ABS 709b4d2d410SLiu Zhe SCTool.selectRange("B1"); 71032c31156SLiu Zhe app.dispatch(".uno:FunctionDialog"); 71122a14f28SLiu Zhe // SC_FunctionWizardDlg_FunctionList.doubleClick(5, 5); 712b4d2d410SLiu Zhe scFunctionWizardDlgFunctionList.select("ABS"); 713b4d2d410SLiu Zhe scFunctionWizardDlgNext.click(); // Use "Next" button 714f9b06548Sdamjan scFunctionWizardDlgEdit1.typeKeys("A1"); 715495a0bcaSCarl Marcum sleep(1); 716b4d2d410SLiu Zhe scFunctionWizardDlg.ok(); 717495a0bcaSCarl Marcum sleep(1); 7187dd2b5bbSLiu Zhe // Verify if the calculated result is equal to the expected result 719495a0bcaSCarl Marcum String result = SCTool.getCellText("B1"); 720495a0bcaSCarl Marcum sleep(1); 721495a0bcaSCarl Marcum assertEquals("The calculated result", expectedResult, result); 722b4d2d410SLiu Zhe discard(); 7237dd2b5bbSLiu Zhe } 724*ca5bdfe8SCarl Marcum 725*ca5bdfe8SCarl Marcum /** 726*ca5bdfe8SCarl Marcum * Test open a non-http(s) type hyperlink (with host only) in a text document. 727*ca5bdfe8SCarl Marcum * (coverage included in fvt.gui.sw.hyperlink.WarningDialog 728*ca5bdfe8SCarl Marcum * testHyperlinkDisplaysWarning() and included here for build verification) 729*ca5bdfe8SCarl Marcum * 1. New a text document 730*ca5bdfe8SCarl Marcum * 2. Insert a dav type hyperlink 731*ca5bdfe8SCarl Marcum * 3. Open hyperlink 732*ca5bdfe8SCarl Marcum * 4. Verify security warning dialog is displayed 733*ca5bdfe8SCarl Marcum * 734*ca5bdfe8SCarl Marcum * @throws Exception 735*ca5bdfe8SCarl Marcum */ 736*ca5bdfe8SCarl Marcum @Test 737*ca5bdfe8SCarl Marcum public void testNonHttpHyperlinkWithHostOnly() throws Exception { 738*ca5bdfe8SCarl Marcum // Create a new text document 739*ca5bdfe8SCarl Marcum newTextDocument(); 740*ca5bdfe8SCarl Marcum writer.waitForExistence(10, 2); 741*ca5bdfe8SCarl Marcum // open the hyperlink dialog 742*ca5bdfe8SCarl Marcum writer.typeKeys("<alt i>"); // insert menu 743*ca5bdfe8SCarl Marcum writer.typeKeys("h"); // hyperlink 744*ca5bdfe8SCarl Marcum hyperlinkInetPathComboBox.setText("dav://nonexistant.url.com"); //target 745*ca5bdfe8SCarl Marcum hyperlinkInetText.setText("dav://nonexistant.url.com"); // displayed text 746*ca5bdfe8SCarl Marcum hyperlinkDialogOkBtn.click(); // apply 747*ca5bdfe8SCarl Marcum hyperlinkDialogCancelBtn.click(); // close 748*ca5bdfe8SCarl Marcum sleep(1); // give the dialog time to close 749*ca5bdfe8SCarl Marcum typeKeys("<shift F10>"); // context menu 750*ca5bdfe8SCarl Marcum typeKeys("o"); // open hyperlink 751*ca5bdfe8SCarl Marcum // we can't be sure of the language so just check for the dialog 752*ca5bdfe8SCarl Marcum boolean msgExists = activeMsgBox.exists(1); // wait 1 second for the dialog 753*ca5bdfe8SCarl Marcum if (msgExists) { 754*ca5bdfe8SCarl Marcum activeMsgBox.no(); // close dialog 755*ca5bdfe8SCarl Marcum } 756*ca5bdfe8SCarl Marcum assertTrue("security warning not displayed", msgExists); 757*ca5bdfe8SCarl Marcum discard(); 758*ca5bdfe8SCarl Marcum } 759*ca5bdfe8SCarl Marcum 760*ca5bdfe8SCarl Marcum }