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 package bvt.gui; 26 27 import static org.junit.Assert.*; 28 import static org.openoffice.test.common.Testspace.*; 29 import static org.openoffice.test.vcl.Tester.*; 30 import static testlib.gui.AppTool.*; 31 import static testlib.gui.UIMap.*; 32 33 import java.awt.Rectangle; 34 35 import org.junit.Before; 36 import org.junit.BeforeClass; 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 import org.openoffice.test.common.Logger; 42 43 import testlib.gui.SCTool; 44 45 /** 46 * 47 */ 48 public class BasicFunctionTest { 49 50 @Rule 51 public Logger log = Logger.getLogger(this); 52 53 @BeforeClass 54 public static void beforeClass() throws Exception { 55 app.clean(); 56 } 57 58 @Before 59 public void before() { 60 app.close(); 61 app.start(); 62 } 63 64 @Test 65 public void testExportAsPDF() throws Exception { 66 String file = prepareData("bvt/pdf.odt"); 67 String exportTo1 = getPath("temp/1.pdf"); 68 String exportTo2 = getPath("temp/2.pdf"); 69 deleteFile(exportTo1); 70 deleteFile(exportTo2); 71 open(file); 72 writer.waitForExistence(10, 1); 73 app.dispatch(".uno:ExportToPDF"); 74 pdfGeneralPage.ok(); 75 submitSaveDlg(exportTo1); 76 sleep(1); 77 String magic = FileUtil.readFileAsString(exportTo1).substring(0, 4); 78 assertEquals("PDF is exported?", "%PDF", magic); 79 80 button(".uno:ExportDirectToPDF").click();//Click via toolbar 81 submitSaveDlg(exportTo2); 82 sleep(1); 83 magic = FileUtil.readFileAsString(exportTo2).substring(0, 4); 84 assertEquals("PDF is exported directly?", "%PDF", magic); 85 } 86 87 /** 88 * Test the File -- Print Dialog show 89 * 90 */ 91 @Test 92 public void testPrinter() { 93 // Create a new text document 94 newTextDocument(); 95 app.dispatch(".uno:PrinterSetup"); 96 if (activeMsgBox.exists(2)) 97 activeMsgBox.ok(); 98 99 // PrintService[] ps = PrintServiceLookup.lookupPrintServices(null, null); 100 // String[] names = new String[ps.length]; 101 // for (int i = 0; i < ps.length; i++) { 102 // names[i] = ps[i].getName(); 103 // } 104 // 105 // assertArrayEquals("Printers Names", names, printerSetUpDlgPrinterNames.getItemsText()); 106 assertTrue("Printer Setup dialog appears", printerSetUpDlg.exists(3)); 107 printerSetUpDlg.cancel(); 108 } 109 110 /** 111 * Test the File -- Java Dialog show 112 * 113 */ 114 // @Test 115 // public void testJavaDialog() { 116 // 117 // // Create a new text document and launch a Wizards dialog which need JVM 118 // // work correctly. 119 // app.dispatch("private:factory/swriter"); 120 // File tempfile = new File(oo.getUserInstallation(), "user/template/myAgendaTemplate.ott"); 121 // FileUtil.deleteFile(tempfile); 122 // sleep(3); 123 // app.dispatch("service:com.sun.star.wizards.agenda.CallWizard?start"); 124 // sleep(5); 125 // assertTrue(Wizards_AgendaDialog.exists(10)); 126 // Wizards_AgendaDialog_FinishButton.click(); 127 // sleep(10); 128 // writer.focus(); 129 // sleep(1); 130 // app.dispatch(".uno:SelectAll"); 131 // typeKeys("<$copy>"); 132 // // System.out.println("now txt:"+app.getClipboard()); 133 // // assertTrue(app.getClipboard().startsWith("<Name>")); 134 // assertNotNull(app.getClipboard()); 135 // } 136 137 /** 138 * Test the Tools / Macros / Organize Dialogs" show 139 * 140 */ 141 @Test 142 public void testRunMacro() { 143 open(prepareData("bvt/macro.ods")); 144 calc.waitForExistence(10, 2); 145 app.dispatch(".uno:RunMacro"); 146 runMacroDlgCategories.expand("macro.ods"); 147 runMacroDlgCategories.expand("Standard"); 148 runMacroDlgCategories.select("Module1"); 149 runMacroDlgCommands.select(0); 150 runMacroDlg.ok(); 151 assertEquals("A3 should be =1+3", "4", SCTool.getCellText("A3")); 152 discard(); 153 } 154 155 /** 156 * Test the About Dialog show 157 * 158 */ 159 @Test 160 public void testHelp() { 161 app.dispatch(".uno:About"); 162 assertTrue(aboutDialog.exists(5)); 163 aboutDialog.ok(); 164 sleep(1); 165 typeKeys("<F1>"); 166 assertTrue(helpWindow.exists(5)); 167 helpWindow.close(); 168 } 169 170 /** 171 * Test inserting a picture in text document 172 * 173 * @throws Exception 174 */ 175 176 @Test 177 public void testInsertPictureInDocument() throws Exception { 178 String bmp_green = prepareData("image/green_256x256.bmp"); 179 String bmp_red = prepareData("image/red_256x256.bmp"); 180 181 // Create a new text document 182 newTextDocument(); 183 // Insert a picture fully filled with green 184 app.dispatch(".uno:InsertGraphic"); 185 submitOpenDlg(bmp_green); 186 writer.click(5,200); 187 sleep(1); 188 189 // Verify if the picture is inserted successfully 190 Rectangle rectangle = GraphicsUtil.findRectangle(writer.getScreenRectangle(), 0xFF00FF00); 191 assertTrue("Green Picture is inserted?" + rectangle, rectangle != null && rectangle.getWidth() > 10); 192 // insert another picture 193 app.dispatch(".uno:InsertGraphic"); 194 submitOpenDlg(bmp_red); 195 writer.click(5, 200); 196 sleep(1); 197 // Verify if the picture is inserted successfully 198 rectangle = GraphicsUtil.findRectangle(writer.getScreenRectangle(), 0xFFFF0000); 199 assertTrue("Green Picture is inserted? " + rectangle, rectangle != null && rectangle.getWidth() > 10); 200 discard(); 201 } 202 203 @Test 204 public void testInsertPictureInSpreadsheet() throws Exception { 205 String bmp_green = prepareData("image/green_64x64.png"); 206 String bmp_red = prepareData("image/red_64x64.png"); 207 newSpreadsheet(); 208 // Insert a picture fully filled with green 209 app.dispatch(".uno:InsertGraphic"); 210 submitOpenDlg(bmp_green); 211 calc.click(5, 150); 212 sleep(1); 213 214 // Verify if the picture is inserted successfully 215 Rectangle rectangle = GraphicsUtil.findRectangle(calc.getScreenRectangle(), 0xFF00FF00); 216 assertTrue("Green Picture is inserted?" + rectangle, rectangle != null && rectangle.getWidth() > 10); 217 218 SCTool.selectRange("C1"); 219 // insert another picture 220 app.dispatch(".uno:InsertGraphic"); 221 submitOpenDlg(bmp_red); 222 calc.click(5, 150); 223 sleep(1); 224 // Verify if the picture is inserted successfully 225 rectangle = GraphicsUtil.findRectangle(calc.getScreenRectangle(), 0xFFFF0000); 226 assertTrue("Red Picture is inserted? " + rectangle, rectangle != null && rectangle.getWidth() > 10); 227 discard(); 228 } 229 230 @Test 231 public void testInsertPictureInPresentation() throws Exception { 232 String bmp_green = prepareData("image/green_256x256.bmp"); 233 String bmp_red = prepareData("image/red_256x256.bmp"); 234 newPresentation(); 235 // Insert a picture fully filled with green 236 app.dispatch(".uno:InsertGraphic"); 237 submitOpenDlg(bmp_green); 238 impress.click(5, 5); 239 sleep(1); 240 241 // Verify if the picture is inserted successfully 242 Rectangle rectangle = GraphicsUtil.findRectangle(impress.getScreenRectangle(), 0xFF00FF00); 243 assertTrue("Green Picture is inserted?" + rectangle, rectangle != null && rectangle.getWidth() > 10); 244 // insert another picture 245 app.dispatch(".uno:InsertGraphic"); 246 submitOpenDlg(bmp_red); 247 impress.click(1, 1); 248 sleep(1); 249 // Verify if the picture is inserted successfully 250 rectangle = GraphicsUtil.findRectangle(impress.getScreenRectangle(), 0xFFFF0000); 251 assertTrue("Red Picture is inserted? " + rectangle, rectangle != null && rectangle.getWidth() > 10); 252 discard(); 253 } 254 255 @Test 256 public void testSlideShow() throws Exception { 257 open(prepareData("bvt/slideshow.odp")); 258 impress.waitForExistence(10, 2); 259 sleep(1); 260 impress.typeKeys("<F5>"); 261 sleep(3); 262 Rectangle rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFFFF0000); 263 assertNotNull("1st slide appears", rectangle); 264 slideShow.click(0.5, 0.5); 265 sleep(2); 266 rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFF00FF00); 267 assertNotNull("2nd slide appears", rectangle); 268 typeKeys("<enter>"); 269 sleep(2); 270 rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFF0000FF); 271 assertNotNull("3rd slide appears", rectangle); 272 slideShow.click(0.5, 0.5); 273 sleep(2); 274 rectangle = GraphicsUtil.findRectangle(slideShow.getScreenRectangle(), 0xFF0000FF); 275 assertNull("The end", rectangle); 276 slideShow.click(0.5, 0.5); 277 sleep(3); 278 assertFalse("Quit", slideShow.exists()); 279 } 280 281 @Test 282 public void testFind() { 283 open(prepareData("bvt/find.odt")); 284 writer.waitForExistence(10, 2); 285 app.dispatch(".uno:SearchDialog"); 286 findDlgFor.setText("OpenOffice"); 287 findDlgFind.click(); 288 sleep(1); 289 writer.typeKeys("<$copy>"); 290 assertEquals("OpenOffice", app.getClipboard()); 291 findDlgFindAll.click(); 292 sleep(1); 293 writer.typeKeys("<$copy>"); 294 assertEquals("OpenOfficeOpenOfficeOpenOffice", app.getClipboard()); 295 findDlgReplaceWith.setText("Awesome OpenOffice"); 296 findDlgReplaceAll.click(); 297 sleep(1); 298 msgbox("Search key replaced 3 times.").ok(); 299 findDlg.close(); 300 sleep(1); 301 assertEquals( 302 "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. ", 303 copyAll()); 304 } 305 306 @Test 307 public void testFillInSpreadsheet() { 308 String[][] expected1 = new String[][] { { "1" }, { "1" }, { "1" }, { "1" }, { "1" }, { "1" }, }; 309 String[][] expected2 = new String[][] { { "2" }, { "2" }, { "2" }, { "2" }, { "2" }, { "2" }, }; 310 String[][] expected3 = new String[][] { { "Hi friends", "Hi friends", "Hi friends", "Hi friends" } }; 311 String[][] expected4 = new String[][] { { "99999.999", "99999.999", "99999.999", "99999.999" } }; 312 String[][] expected5 = new String[][] { 313 { "99999.999", "-10" }, { "100000.999", "-9" }, { "100001.999", "-8" }, { "100002.999", "-7" }, { "100003.999", "-6" } 314 }; 315 newSpreadsheet(); 316 SCTool.selectRange("C5"); 317 typeKeys("1<enter>"); 318 SCTool.selectRange("C5:C10"); 319 app.dispatch(".uno:FillDown"); 320 assertArrayEquals("Fill Down:", expected1, SCTool.getCellTexts("C5:C10")); 321 322 SCTool.selectRange("D10"); 323 typeKeys("2<enter>"); 324 SCTool.selectRange("D5:D10"); 325 app.dispatch(".uno:FillUp"); 326 assertArrayEquals("Fill Up:", expected2, SCTool.getCellTexts("D5:D10")); 327 328 SCTool.selectRange("A1"); 329 typeKeys("Hi friends<enter>"); 330 SCTool.selectRange("A1:D1"); 331 app.dispatch(".uno:FillRight"); 332 assertArrayEquals("Fill Right:", expected3, SCTool.getCellTexts("A1:D1")); 333 334 SCTool.selectRange("D2"); 335 typeKeys("99999.999<enter>"); 336 SCTool.selectRange("A2:D2"); 337 app.dispatch(".uno:FillLeft"); 338 assertArrayEquals("Fill left:", expected4, SCTool.getCellTexts("A2:D2")); 339 340 SCTool.selectRange("E1"); 341 typeKeys("99999.999<tab>-10<enter>"); 342 343 SCTool.selectRange("E1:F5"); 344 app.dispatch(".uno:FillSeries"); 345 fillSeriesDlg.ok(); 346 sleep(1); 347 assertArrayEquals("Fill series..", expected5, SCTool.getCellTexts("E1:F5")); 348 discard(); 349 } 350 351 @Test 352 public void testSort() { 353 String[][] expected1 = new String[][] { { "-9999999" }, { "-1.1" }, { "-1.1" }, { "0" }, { "0" }, { "0.1" }, { "10" }, { "12" }, { "9999999" }, { "9999999" }, 354 355 }; 356 String[][] expected2 = new String[][] { { "TRUE", "Oracle" }, { "TRUE", "OpenOffice" }, { "FALSE", "OpenOffice" }, { "TRUE", "IBM" }, { "FALSE", "IBM" }, 357 { "TRUE", "Google" }, { "FALSE", "facebook " }, { "TRUE", "Apache" }, { "TRUE", "!yahoo" }, { "TRUE", "" }, 358 359 }; 360 361 String[][] expected3 = new String[][] { { "Sunday" }, { "Monday" }, { "Tuesday" }, { "Wednesday" }, { "Thursday" }, { "Friday" }, { "Saturday" }, 362 363 }; 364 365 String[][] expected4 = new String[][] { { "-$10.00" }, { "$0.00" }, { "$0.00" }, { "$1.00" }, { "$3.00" }, { "$9.00" }, { "$123.00" }, { "$200.00" }, { "$400.00" }, 366 { "$10,000.00" }, 367 368 }; 369 open(prepareData("bvt/sort.ods")); 370 calc.waitForExistence(10, 2); 371 SCTool.selectRange("A1:A10"); 372 app.dispatch(".uno:DataSort"); 373 sortWarningDlgCurrent.click(); 374 assertEquals(1, sortPageBy1.getSelIndex()); 375 sortPage.ok(); 376 sleep(1); 377 assertArrayEquals("Sorted Data", expected1, SCTool.getCellTexts("A1:A10")); 378 SCTool.selectRange("B1:C10"); 379 app.dispatch(".uno:DataSort"); 380 381 sortPageBy1.select(2); 382 sortPageDescending1.check(); 383 assertFalse(sortPageBy3.isEnabled()); 384 assertFalse(sortPageAscending3.isEnabled()); 385 assertFalse(sortPageDescending3.isEnabled()); 386 sortPageBy2.select(1); 387 assertTrue(sortPageBy3.isEnabled()); 388 assertTrue(sortPageAscending3.isEnabled()); 389 assertTrue(sortPageDescending3.isEnabled()); 390 sortPageDescending2.check(); 391 sortPageBy2.select(0); 392 assertFalse(sortPageBy3.isEnabled()); 393 assertFalse(sortPageAscending3.isEnabled()); 394 assertFalse(sortPageDescending3.isEnabled()); 395 sortPageBy2.select(1); 396 sortPage.ok(); 397 sleep(1); 398 399 assertArrayEquals("Sorted Data", expected2, SCTool.getCellTexts("B1:C10")); 400 SCTool.selectRange("D1:D7"); 401 app.dispatch(".uno:DataSort"); 402 sortWarningDlgCurrent.click(); 403 sortOptionsPage.select(); 404 sortOptionsPageRangeContainsColumnLabels.uncheck(); 405 sortOptionsPageCustomSortOrder.check(); 406 sortOptionsPageCustomSortOrderList.select("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"); 407 sortOptionsPage.ok(); 408 sleep(1); 409 assertArrayEquals("Sorted Data", expected3, SCTool.getCellTexts("D1:D7")); 410 411 SCTool.selectRange("E1:E10"); 412 app.dispatch(".uno:DataSort"); 413 sortWarningDlgCurrent.click(); 414 sortPage.ok(); 415 sleep(1); 416 assertArrayEquals("Sorted Data", expected4, SCTool.getCellTexts("E1:E10")); 417 discard(); 418 } 419 420 /** 421 * Test insert a chart in a draw document 1. New a draw document 2. Insert a 422 * chart 3. Check if the chart is inserted successfully 423 * 424 * @throws Exception 425 */ 426 @Test 427 public void testInsertChartInDraw() throws Exception { 428 // Create a new drawing document 429 newDrawing(); 430 // Insert a chart 431 app.dispatch(".uno:InsertObjectChart"); 432 sleep(3); 433 434 // Verify if the chart is inserted successfully 435 assertTrue("Chart Editor appears", chart.exists(3)); 436 // Focus on edit pane 437 draw.click(5, 5); 438 sleep(1); 439 assertFalse("Chart Editor appears", chart.exists()); 440 discard(); 441 } 442 443 /** 444 * Test insert a chart in a text document 1. New a text document 2. Insert a 445 * chart 3. Check if the chart is inserted successfully 446 * 447 * @throws Exception 448 */ 449 @Test 450 public void testInsertChartInDocument() throws Exception { 451 // Create a new text document 452 newTextDocument(); 453 // Insert a chart 454 app.dispatch(".uno:InsertObjectChart"); 455 sleep(3); 456 457 // Verify if the chart is inserted successfully 458 assertTrue("Chart Editor appears", chart.exists(3)); 459 // Focus on edit pane 460 writer.click(5, 5); 461 sleep(1); 462 assertFalse("Chart Editor appears", chart.exists()); 463 discard(); 464 } 465 466 /** 467 * Test insert a chart in a spreadsheet document 1. New a spreadsheet 468 * document 2. Insert a chart 3. Check if the chart is inserted successfully 469 * 470 * @throws Exception 471 */ 472 @Test 473 public void testInsertChartInSpreadsheet() throws Exception { 474 // Create a new spreadsheet document 475 newSpreadsheet(); 476 // Insert a chart 477 app.dispatch(".uno:InsertObjectChart"); 478 sleep(3); 479 chartWizard.ok(); 480 481 // Verify if the chart is inserted successfully 482 assertTrue("Chart Editor appears", chart.exists(3)); 483 // Focus on edit pane 484 calc.click(5, 5); 485 sleep(1); 486 assertFalse("Chart Editor appears", chart.exists()); 487 discard(); 488 } 489 490 /** 491 * Test insert a chart in a presentation document 1. New a presentation 492 * document 2. Insert a chart 3. Check if the chart is inserted successfully 493 * 494 * @throws Exception 495 */ 496 @Test 497 public void testInsertChartInPresentation() throws Exception { 498 // Create a new presentation document 499 newPresentation(); 500 // Insert a chart 501 app.dispatch(".uno:InsertObjectChart"); 502 sleep(3); 503 // Verify if the chart is inserted successfully 504 assertTrue("Chart Editor appears", chart.exists(3)); 505 // Focus on edit pane 506 impress.click(5, 5); 507 sleep(1); 508 assertFalse("Chart Editor appears", chart.exists()); 509 discard(); 510 } 511 512 /** 513 * Test insert a table in a draw document 1. New a draw document 2. Insert a 514 * default table 3. Check if the table is inserted successfully 515 * 516 * @throws Exception 517 */ 518 @Test 519 public void testInsertTableInDraw() throws Exception { 520 // Create a new drawing document 521 newDrawing(); 522 // Insert a table 523 app.dispatch(".uno:InsertTable"); 524 insertTable.ok(); 525 sleep(1); 526 draw.typeKeys("3"); 527 assertTrue("Table Toolbar appears", tableToolbar.exists(3)); 528 // assertEquals("The cell content", "3", copyAll()); 529 discard(); 530 } 531 532 /** 533 * Test insert a table in a text document 1. New a text document 2. Insert a 534 * default table 3. Check if the table is inserted successfully 535 * 536 * @throws Exception 537 */ 538 @Test 539 public void testInsertTableInDocument() throws Exception { 540 // Create a new text document 541 newTextDocument(); 542 // Insert a table 543 app.dispatch(".uno:InsertTable"); 544 writerInsertTable.ok(); 545 sleep(1); 546 writer.typeKeys("3"); 547 // Verify if the table toolbar is active 548 assertTrue("Table Toolbar appears", tableToolbar.exists(3)); 549 // assertEquals("The cell content", "3", copyAll()); 550 discard(); 551 } 552 553 /** 554 * Test insert a table in a presentation document 1. New a presentation 555 * document 2. Insert a default table 3. Check if the table is inserted 556 * successfully 557 * 558 * @throws Exception 559 */ 560 @Test 561 public void testInsertTableInPresentation() throws Exception { 562 // Create a new presentation document 563 newPresentation(); 564 565 // Insert a table 566 app.dispatch(".uno:InsertTable"); 567 insertTable.ok(); 568 sleep(1); 569 impress.typeKeys("3"); 570 assertTrue("Table Toolbar appears", tableToolbar.exists(3)); 571 // assertEquals("The cell content", "3", copyAll()); 572 discard(); 573 } 574 575 /** 576 * Test insert a function in a spreadsheet document via Sum button 1. New a 577 * spreadsheet document 2. Insert a function via Sum button 3. Check if the 578 * result is correct 579 * 580 * @throws Exception 581 */ 582 @Test 583 public void testSumInFormulaBar() throws Exception { 584 // Create a new spreadsheet document 585 newSpreadsheet(); 586 // Insert source numbers 587 String sourceNumber1 = "5"; 588 String sourceNumber2 = "3"; 589 String expectedResult = "8"; 590 SCTool.selectRange("A1"); 591 typeKeys(sourceNumber1); 592 SCTool.selectRange("B1"); 593 typeKeys(sourceNumber2); 594 // Insert a function via Sum button 595 SCTool.selectRange("C1"); 596 scInputBarSum.click(); 597 typeKeys("<enter>"); 598 // Verify if the calculated result is equal to the expected result 599 assertEquals("The calculated result", expectedResult, SCTool.getCellText("C1")); 600 discard(); 601 } 602 603 /** 604 * Test insert a function in a spreadsheet document via inputbar 1. New a 605 * spreadsheet document 2. Insert a function via inputbar: COS 3. Check if 606 * the result is correct 607 * 608 * @throws Exception 609 */ 610 @Test 611 public void testInsertFunctionViaFormulaBar() throws Exception { 612 // Create a new spreadsheet document 613 newSpreadsheet(); 614 // Insert source numbers and expected result 615 String sourceData = "0"; 616 String expectedResult = "1"; 617 SCTool.selectRange("A1"); 618 typeKeys(sourceData); 619 620 // Insert a function via inputbar: COS 621 SCTool.selectRange("D1"); 622 scInputBarInput.inputKeys("=COS(A1)"); 623 typeKeys("<enter>"); 624 625 // Verify if the calculated result is equal to the expected result 626 assertEquals("The calculated result", expectedResult, SCTool.getCellText("D1")); 627 discard(); 628 } 629 630 /** 631 * Test insert a function in a spreadsheet document via Function Wizard 632 * Dialog 1. New a spreadsheet document 2. Insert a function via Function 633 * Wizard Dialog: ABS 3. Check if the result is correct 634 * 635 * @throws Exception 636 */ 637 @Test 638 public void testFunctionWizardInFormulaBar() throws Exception { 639 // Create a new spreadsheet document 640 newSpreadsheet(); 641 // Insert source number 642 String sourceNumber = "-5"; 643 String expectedResult = "5"; 644 SCTool.selectRange("A1"); 645 typeKeys(sourceNumber); 646 typeKeys("<enter>"); 647 // Insert a function via Function Wizard Dialog: ABS 648 SCTool.selectRange("B1"); 649 app.dispatch(".uno:FunctionDialog"); 650 // SC_FunctionWizardDlg_FunctionList.doubleClick(5, 5); 651 scFunctionWizardDlgFunctionList.select("ABS"); 652 scFunctionWizardDlgNext.click(); // Use "Next" button 653 scFunctionWizardDlgEdit1.inputKeys("A1"); 654 scFunctionWizardDlg.ok(); 655 // Verify if the calculated result is equal to the expected result 656 assertEquals("The calculated result", expectedResult, SCTool.getCellText("B1")); 657 discard(); 658 } 659 } 660