157caf934SLiu Zhe /************************************************************** 257caf934SLiu Zhe * 357caf934SLiu Zhe * Licensed to the Apache Software Foundation (ASF) under one 457caf934SLiu Zhe * or more contributor license agreements. See the NOTICE file 557caf934SLiu Zhe * distributed with this work for additional information 657caf934SLiu Zhe * regarding copyright ownership. The ASF licenses this file 757caf934SLiu Zhe * to you under the Apache License, Version 2.0 (the 857caf934SLiu Zhe * "License"); you may not use this file except in compliance 957caf934SLiu Zhe * with the License. You may obtain a copy of the License at 1057caf934SLiu Zhe * 1157caf934SLiu Zhe * http://www.apache.org/licenses/LICENSE-2.0 1257caf934SLiu Zhe * 1357caf934SLiu Zhe * Unless required by applicable law or agreed to in writing, 1457caf934SLiu Zhe * software distributed under the License is distributed on an 1557caf934SLiu Zhe * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1657caf934SLiu Zhe * KIND, either express or implied. See the License for the 1757caf934SLiu Zhe * specific language governing permissions and limitations 1857caf934SLiu Zhe * under the License. 1957caf934SLiu Zhe * 2057caf934SLiu Zhe *************************************************************/ 2157caf934SLiu Zhe 2257caf934SLiu Zhe /** 2357caf934SLiu Zhe * 2457caf934SLiu Zhe */ 2557caf934SLiu Zhe 2657caf934SLiu Zhe package pvt.gui; 2757caf934SLiu Zhe 28f46d12a6SLiu Zhe import static org.junit.Assert.*; 2957caf934SLiu Zhe import static org.openoffice.test.common.Testspace.*; 3057caf934SLiu Zhe import static org.openoffice.test.vcl.Tester.*; 31f46d12a6SLiu Zhe import static testlib.gui.AppTool.*; 3257caf934SLiu Zhe import static testlib.gui.UIMap.*; 3357caf934SLiu Zhe 34f46d12a6SLiu Zhe import java.awt.Rectangle; 3557caf934SLiu Zhe import java.util.HashMap; 3657caf934SLiu Zhe 378cce5abbSLiu Zhe import org.junit.After; 3857caf934SLiu Zhe import org.junit.AfterClass; 3908ed1236SLiu Zhe import org.junit.Before; 4057caf934SLiu Zhe import org.junit.BeforeClass; 4157caf934SLiu Zhe import org.junit.Rule; 4257caf934SLiu Zhe import org.junit.Test; 4357caf934SLiu Zhe import org.junit.rules.TestName; 4457caf934SLiu Zhe import org.openoffice.test.OpenOffice; 4557caf934SLiu Zhe import org.openoffice.test.common.Condition; 46e4b83892SLiu Zhe import org.openoffice.test.common.DataSheet; 47f46d12a6SLiu Zhe import org.openoffice.test.common.GraphicsUtil; 4857caf934SLiu Zhe import org.openoffice.test.common.Logger; 4957caf934SLiu Zhe 5057caf934SLiu Zhe 5157caf934SLiu Zhe public class Benchmark { 5257caf934SLiu Zhe @Rule 5357caf934SLiu Zhe public Logger log = Logger.getLogger(this); 5457caf934SLiu Zhe 5557caf934SLiu Zhe @Rule 5657caf934SLiu Zhe public TestName testname = new TestName(); 5757caf934SLiu Zhe 58e4b83892SLiu Zhe private static DataSheet result; 5957caf934SLiu Zhe 60e4b83892SLiu Zhe private static final double INTERVAL = 0.1; 6157caf934SLiu Zhe 62*464275f7SLiu Zhe private static int repeat = 2; 638cce5abbSLiu Zhe 648cce5abbSLiu Zhe private int i = 0; 659edf8282SLiu Zhe Benchmark()6657caf934SLiu Zhe public Benchmark() { 6757caf934SLiu Zhe 6857caf934SLiu Zhe } 6957caf934SLiu Zhe 7057caf934SLiu Zhe @BeforeClass beforeClass()7157caf934SLiu Zhe public static void beforeClass() throws Exception { 7257caf934SLiu Zhe OpenOffice.killAll(); 738969bfceSLiu Zhe result = new DataSheet(getFile("output/" + Benchmark.class.getName() + ".xml")); 749edf8282SLiu Zhe result.addRow("data", "Scenario", "No", "Consumed Time", "Memory(VSZ)", "Memory(RSS)", "Handles(Windows Only)"); 7557caf934SLiu Zhe } 7657caf934SLiu Zhe 7757caf934SLiu Zhe @AfterClass afterClass()7857caf934SLiu Zhe public static void afterClass() throws Exception { 79*464275f7SLiu Zhe //app.stop(); 8057caf934SLiu Zhe } 8157caf934SLiu Zhe 8208ed1236SLiu Zhe @Before before()8308ed1236SLiu Zhe public void before() { 8408ed1236SLiu Zhe app.start(true); 8508ed1236SLiu Zhe app.quit(); 8608ed1236SLiu Zhe } 8708ed1236SLiu Zhe 888cce5abbSLiu Zhe @After after()898cce5abbSLiu Zhe public void after() { 908cce5abbSLiu Zhe if (i < repeat) 918cce5abbSLiu Zhe result.addRow("data", testname.getMethodName(), i, "err", "err", "err", "err", "err"); 928cce5abbSLiu Zhe } 938cce5abbSLiu Zhe addRecord(long start, long end)948cce5abbSLiu Zhe private void addRecord(long start, long end) { 959edf8282SLiu Zhe sleep(2); 969edf8282SLiu Zhe HashMap<String, Object> perf = aoo.getPerfData(); 979edf8282SLiu Zhe result.addRow("data", testname.getMethodName(), i, (end - start), perf.get("vsz"), perf.get("rss"), perf.get("handles")); 9857caf934SLiu Zhe } 9957caf934SLiu Zhe 10057caf934SLiu Zhe @Test coolStartup()10157caf934SLiu Zhe public void coolStartup() throws Exception { 1028cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 10357caf934SLiu Zhe aoo.cleanUserInstallation(); 1049edf8282SLiu Zhe assertFalse("User profile exists", aoo.getUserInstallation().exists()); 10557caf934SLiu Zhe aoo.start(); 10657caf934SLiu Zhe long start = System.currentTimeMillis(); 10757caf934SLiu Zhe startcenter.waitForExistence(120, INTERVAL); 10857caf934SLiu Zhe long end = System.currentTimeMillis(); 1098cce5abbSLiu Zhe addRecord(start, end); 1109edf8282SLiu Zhe app.quit(); 1119edf8282SLiu Zhe } 1128cce5abbSLiu Zhe 11357caf934SLiu Zhe } 11457caf934SLiu Zhe 11557caf934SLiu Zhe @Test warmStartup()11657caf934SLiu Zhe public void warmStartup() throws Exception { 1178cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1189edf8282SLiu Zhe assertTrue("User profile exists", aoo.getUserInstallation().exists()); 11957caf934SLiu Zhe aoo.start(); 12057caf934SLiu Zhe long start = System.currentTimeMillis(); 12157caf934SLiu Zhe startcenter.waitForExistence(120, INTERVAL); 12257caf934SLiu Zhe long end = System.currentTimeMillis(); 1238cce5abbSLiu Zhe addRecord(start, end); 1249edf8282SLiu Zhe app.quit(); 12557caf934SLiu Zhe } 1268cce5abbSLiu Zhe 12757caf934SLiu Zhe } 12857caf934SLiu Zhe 12957caf934SLiu Zhe @Test newTextDocument()13057caf934SLiu Zhe public void newTextDocument() { 1318cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1329edf8282SLiu Zhe app.start(); 13357caf934SLiu Zhe startCenterWriterButton.click(0.5, 0.5); 13457caf934SLiu Zhe long start = System.currentTimeMillis(); 13557caf934SLiu Zhe writer.waitForExistence(60, INTERVAL); 13657caf934SLiu Zhe long end = System.currentTimeMillis(); 1378cce5abbSLiu Zhe addRecord(start, end); 1389edf8282SLiu Zhe app.quit(); 13957caf934SLiu Zhe } 1408cce5abbSLiu Zhe 14157caf934SLiu Zhe } 14257caf934SLiu Zhe 14357caf934SLiu Zhe @Test newSpreadsheet()14457caf934SLiu Zhe public void newSpreadsheet() { 1458cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1469edf8282SLiu Zhe app.start(); 14757caf934SLiu Zhe startCenterCalcButton.click(0.5, 0.5); 14857caf934SLiu Zhe long start = System.currentTimeMillis(); 14957caf934SLiu Zhe calc.waitForExistence(60, INTERVAL); 15057caf934SLiu Zhe long end = System.currentTimeMillis(); 1518cce5abbSLiu Zhe addRecord(start, end); 1529edf8282SLiu Zhe app.quit(); 15357caf934SLiu Zhe } 1548cce5abbSLiu Zhe 15557caf934SLiu Zhe } 15657caf934SLiu Zhe 15757caf934SLiu Zhe @Test newPresentation()15857caf934SLiu Zhe public void newPresentation() { 1598cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1609edf8282SLiu Zhe app.start(); 16157caf934SLiu Zhe startCenterImpressButton.click(0.5, 0.5); 16257caf934SLiu Zhe presentationWizard.click(0.9, 0.95); 16357caf934SLiu Zhe long start = System.currentTimeMillis(); 16457caf934SLiu Zhe impress.waitForExistence(60, INTERVAL); 16557caf934SLiu Zhe long end = System.currentTimeMillis(); 1668cce5abbSLiu Zhe addRecord(start, end); 1679edf8282SLiu Zhe app.quit(); 1689edf8282SLiu Zhe } 1698cce5abbSLiu Zhe 1709edf8282SLiu Zhe } 1719edf8282SLiu Zhe 1729edf8282SLiu Zhe @Test slideShow()1739edf8282SLiu Zhe public void slideShow() { 1749edf8282SLiu Zhe String path = prepareData("pvt/slideshow.odp"); 1759edf8282SLiu Zhe final Rectangle rect = GraphicsUtil.getScreenRectangle(); 1769edf8282SLiu Zhe // when slide show is running, top-center area will be filled with green 1779edf8282SLiu Zhe rect.setRect(rect.getCenterX(), 2, 2, 2); 1788cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1799edf8282SLiu Zhe app.start(); 1809edf8282SLiu Zhe open(path); 1819edf8282SLiu Zhe impress.waitForExistence(60, 1); 1829edf8282SLiu Zhe sleep(2); 1839edf8282SLiu Zhe assertFalse("Slideshow control exists", slideShow.exists()); 1849edf8282SLiu Zhe assertFalse("Slideshow is not started", GraphicsUtil.isFilledWith(0xFF00FF00, rect)); 1859edf8282SLiu Zhe typeKeys("<F5>"); 1869edf8282SLiu Zhe long start = System.currentTimeMillis(); 1879edf8282SLiu Zhe new Condition() { 1889edf8282SLiu Zhe @Override 1899edf8282SLiu Zhe public boolean value() { 1909edf8282SLiu Zhe return GraphicsUtil.isFilledWith(0xFF00FF00, rect); 1919edf8282SLiu Zhe } 1929edf8282SLiu Zhe 1939edf8282SLiu Zhe }.waitForTrue("", 120, INTERVAL); 1949edf8282SLiu Zhe long end = System.currentTimeMillis(); 1958cce5abbSLiu Zhe addRecord(start, end); 1969edf8282SLiu Zhe slideShow.typeKeys("<esc>"); 1979edf8282SLiu Zhe sleep(2); 1989edf8282SLiu Zhe app.quit(); 19957caf934SLiu Zhe } 2008cce5abbSLiu Zhe 20157caf934SLiu Zhe } 20257caf934SLiu Zhe 20357caf934SLiu Zhe @Test loadFinishPlainODT()204f46d12a6SLiu Zhe public void loadFinishPlainODT() { 205f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.odt", "Page 1 / 23[0-9]{1}"); 20657caf934SLiu Zhe } 20757caf934SLiu Zhe 20857caf934SLiu Zhe @Test loadFinishPlainDOC()209f46d12a6SLiu Zhe public void loadFinishPlainDOC() { 210e4b83892SLiu Zhe loadFinish("pvt/plain_50p.doc", "Page i / 5[0-9]{1}"); 21157caf934SLiu Zhe } 21257caf934SLiu Zhe 21357caf934SLiu Zhe @Test loadFinishPlainDOCX()214f46d12a6SLiu Zhe public void loadFinishPlainDOCX() { 2158cce5abbSLiu Zhe loadFinish("pvt/plain_200p.docx", "Page 1 / 1[8-9]{1}[0-9]{1}"); 21657caf934SLiu Zhe } 21757caf934SLiu Zhe 21857caf934SLiu Zhe @Test loadFinishPlainODS()21957caf934SLiu Zhe public void loadFinishPlainODS() { 220f46d12a6SLiu Zhe loadFinish("pvt/plain_11s.ods", "Sheet 1 / 11"); 22157caf934SLiu Zhe } 22257caf934SLiu Zhe 22357caf934SLiu Zhe @Test loadFinishPlainXLS()224f46d12a6SLiu Zhe public void loadFinishPlainXLS() { 225f46d12a6SLiu Zhe loadFinish("pvt/plain_11s.xls", "Sheet 1 / 11"); 22657caf934SLiu Zhe } 22757caf934SLiu Zhe 22857caf934SLiu Zhe @Test loadFinishPlainXLSX()229f46d12a6SLiu Zhe public void loadFinishPlainXLSX() { 230f46d12a6SLiu Zhe loadFinish("pvt/plain_11s.xlsx", "Sheet 1 / 11"); 23157caf934SLiu Zhe } 23257caf934SLiu Zhe 23357caf934SLiu Zhe @Test loadFinishPlainODP()23457caf934SLiu Zhe public void loadFinishPlainODP() { 235f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.odp", "Slide 1 / 200"); 23657caf934SLiu Zhe } 23757caf934SLiu Zhe 23857caf934SLiu Zhe @Test loadFinishPlainPPT()23957caf934SLiu Zhe public void loadFinishPlainPPT() { 240f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.ppt", "Slide 1 / 200"); 24157caf934SLiu Zhe } 24257caf934SLiu Zhe 24357caf934SLiu Zhe @Test loadFinishPlainPPTX()244f46d12a6SLiu Zhe public void loadFinishPlainPPTX() { 245f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.pptx", "Slide 1 / 200"); 246f46d12a6SLiu Zhe } 247f46d12a6SLiu Zhe 248f46d12a6SLiu Zhe @Test loadFinishComplexDOC()249f46d12a6SLiu Zhe public void loadFinishComplexDOC() { 250e4b83892SLiu Zhe loadFinish("pvt/complex_300p.doc", "Page 1 / 3[0-9]{2}"); 251f46d12a6SLiu Zhe } 252f46d12a6SLiu Zhe 253f46d12a6SLiu Zhe @Test loadFinishComplexDOCX()2549edf8282SLiu Zhe public void loadFinishComplexDOCX() { 2558969bfceSLiu Zhe loadFinish("pvt/complex_400p.docx", "Page 1 / 3[2-9]{2}"); 2569edf8282SLiu Zhe } 2579edf8282SLiu Zhe 2589edf8282SLiu Zhe @Test loadFinishComplexODT()259f46d12a6SLiu Zhe public void loadFinishComplexODT() { 260e4b83892SLiu Zhe loadFinish("pvt/complex_800p.odt", "Page 1 / 8[0-9]{2}"); 261f46d12a6SLiu Zhe } 262f46d12a6SLiu Zhe 263f46d12a6SLiu Zhe @Test loadFinishComplexODS()264f46d12a6SLiu Zhe public void loadFinishComplexODS() { 2658969bfceSLiu Zhe loadFinish("pvt/complex_19s.ods", "Sheet 8 / 19"); 266f46d12a6SLiu Zhe } 267f46d12a6SLiu Zhe 268f46d12a6SLiu Zhe @Test loadFinishComplexXLS()2698cce5abbSLiu Zhe public void loadFinishComplexXLS() { 2708cce5abbSLiu Zhe loadFinish("pvt/complex_29s.xls", "Sheet 2 / 29"); 2718cce5abbSLiu Zhe } 2728cce5abbSLiu Zhe 2738cce5abbSLiu Zhe @Test loadFinishComplexXLSX()2748cce5abbSLiu Zhe public void loadFinishComplexXLSX() { 2758cce5abbSLiu Zhe loadFinish("pvt/complex_29s.xlsx", "Sheet 29 / 29"); 2768cce5abbSLiu Zhe } 2778cce5abbSLiu Zhe 2788cce5abbSLiu Zhe @Test loadFinishComplexODP()27957caf934SLiu Zhe public void loadFinishComplexODP() { 2809edf8282SLiu Zhe loadFinish("pvt/complex_150p.odp", "Slide 1 / 150"); 28157caf934SLiu Zhe } 28257caf934SLiu Zhe 2838cce5abbSLiu Zhe @Test loadFinishComplexPPT()2848cce5abbSLiu Zhe public void loadFinishComplexPPT() { 2858cce5abbSLiu Zhe loadFinish("pvt/complex_100p.ppt", "Slide 1 / 100"); 2868cce5abbSLiu Zhe } 2878cce5abbSLiu Zhe 2888cce5abbSLiu Zhe @Test loadFinishComplexPPTX()2898cce5abbSLiu Zhe public void loadFinishComplexPPTX() { 2908cce5abbSLiu Zhe loadFinish("pvt/complex_100p.pptx", "Slide 1 / 100"); 2918cce5abbSLiu Zhe } 2928cce5abbSLiu Zhe loadFinish(String file, final String indicator)29357caf934SLiu Zhe public void loadFinish(String file, final String indicator) { 294f46d12a6SLiu Zhe final int openIndicatorIndex = file.matches(".*\\.(odp|ppt|pptx)$") ? 4 : 0; 29557caf934SLiu Zhe String path = prepareData(file); 2968cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 2979edf8282SLiu Zhe app.start(); 29857caf934SLiu Zhe app.dispatch(".uno:Open"); 29957caf934SLiu Zhe filePickerPath.setText(path); 3009edf8282SLiu Zhe sleep(1); 301f46d12a6SLiu Zhe filePickerOpen.click(0.5, 0.5); 30257caf934SLiu Zhe long start = System.currentTimeMillis(); 30357caf934SLiu Zhe new Condition() { 30457caf934SLiu Zhe @Override 30557caf934SLiu Zhe public boolean value() { 306f46d12a6SLiu Zhe try { 307f46d12a6SLiu Zhe String text = statusBar.getItemText(openIndicatorIndex); 308f46d12a6SLiu Zhe return text.matches(indicator); 309f46d12a6SLiu Zhe } catch (Exception e) { 31057caf934SLiu Zhe return false; 311f46d12a6SLiu Zhe } 31257caf934SLiu Zhe } 31357caf934SLiu Zhe 31457caf934SLiu Zhe }.waitForTrue("", 120, INTERVAL); 31557caf934SLiu Zhe long end = System.currentTimeMillis(); 3168cce5abbSLiu Zhe addRecord(start, end); 317f46d12a6SLiu Zhe discard(); 3189edf8282SLiu Zhe app.quit(); 31957caf934SLiu Zhe } 32057caf934SLiu Zhe 321f46d12a6SLiu Zhe } 32257caf934SLiu Zhe 323f46d12a6SLiu Zhe @Test savePlainODT()324f46d12a6SLiu Zhe public void savePlainODT() { 325f46d12a6SLiu Zhe save("pvt/plain_200p.odt", "Page 1 / 23[0-9]{1}"); 326f46d12a6SLiu Zhe } 327f46d12a6SLiu Zhe 328f46d12a6SLiu Zhe @Test savePlainDOC()3298cce5abbSLiu Zhe public void savePlainDOC() { 3308cce5abbSLiu Zhe save("pvt/plain_50p.doc", "Page i / 5[0-9]{1}"); 331f46d12a6SLiu Zhe } 332f46d12a6SLiu Zhe 333f46d12a6SLiu Zhe @Test savePlainODS()334f46d12a6SLiu Zhe public void savePlainODS() { 335f46d12a6SLiu Zhe save("pvt/plain_11s.ods", "Sheet 1 / 11"); 336f46d12a6SLiu Zhe } 337f46d12a6SLiu Zhe 338f46d12a6SLiu Zhe @Test savePlainXLS()3398cce5abbSLiu Zhe public void savePlainXLS() { 3408cce5abbSLiu Zhe save("pvt/plain_11s.xls", "Sheet 1 / 11"); 341f46d12a6SLiu Zhe } 342f46d12a6SLiu Zhe 343f46d12a6SLiu Zhe @Test savePlainODP()344f46d12a6SLiu Zhe public void savePlainODP() { 345f46d12a6SLiu Zhe save("pvt/plain_200p.odp", "Slide 1 / 200"); 346f46d12a6SLiu Zhe } 347f46d12a6SLiu Zhe 348f46d12a6SLiu Zhe @Test savePlainPPT()349f46d12a6SLiu Zhe public void savePlainPPT() { 350f46d12a6SLiu Zhe save("pvt/plain_200p.ppt", "Slide 1 / 200"); 351f46d12a6SLiu Zhe } 352f46d12a6SLiu Zhe 353f46d12a6SLiu Zhe @Test saveComplexODT()3548cce5abbSLiu Zhe public void saveComplexODT() { 3558cce5abbSLiu Zhe save("pvt/complex_800p.odt", "Page 1 / 8[0-9]{2}"); 3568cce5abbSLiu Zhe } 3578cce5abbSLiu Zhe 3588cce5abbSLiu Zhe @Test saveComplexDOC()3598cce5abbSLiu Zhe public void saveComplexDOC() { 3608cce5abbSLiu Zhe save("pvt/complex_300p.doc", "Page 1 / 3[0-9]{2}"); 3618cce5abbSLiu Zhe } 3628cce5abbSLiu Zhe 3638cce5abbSLiu Zhe @Test saveComplexODS()3648cce5abbSLiu Zhe public void saveComplexODS() { 3658cce5abbSLiu Zhe save("pvt/complex_19s.ods", "Sheet 8 / 19"); 3668cce5abbSLiu Zhe } 3678cce5abbSLiu Zhe 3688cce5abbSLiu Zhe @Test saveComplexXLS()3698cce5abbSLiu Zhe public void saveComplexXLS() { 3708cce5abbSLiu Zhe save("pvt/complex_29s.xls", "Sheet 2 / 29"); 3718cce5abbSLiu Zhe } 3728cce5abbSLiu Zhe 3738cce5abbSLiu Zhe @Test saveComplexODP()374f46d12a6SLiu Zhe public void saveComplexODP() { 3759edf8282SLiu Zhe save("pvt/complex_150p.odp", "Slide 1 / 150"); 376f46d12a6SLiu Zhe } 377f46d12a6SLiu Zhe 3788cce5abbSLiu Zhe @Test saveComplexPPT()3798cce5abbSLiu Zhe public void saveComplexPPT() { 3808cce5abbSLiu Zhe save("pvt/complex_100p.ppt", "Slide 1 / 100"); 3818cce5abbSLiu Zhe } 3828cce5abbSLiu Zhe save(String file, final String openIndicator)383f46d12a6SLiu Zhe public void save(String file, final String openIndicator) { 384f46d12a6SLiu Zhe boolean alienFormat = file.matches(".*\\.(doc|xls|ppt|docx|xlsx|pptx)$"); 385f46d12a6SLiu Zhe final int openIndicatorIndex = file.matches(".*\\.(odp|ppt|pptx)$") ? 4 : 0; 386f46d12a6SLiu Zhe final int saveIndicatorIndex = file.matches(".*\\.(odt|doc|docx)$") ? 5 : file.matches(".*\\.(ods|xls|xlsx)$") ? 4 : 2; 387f46d12a6SLiu Zhe String picture = prepareData("image/red_64x64.bmp"); 3888cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 389f46d12a6SLiu Zhe String dir = "temp/file" + i; 390f46d12a6SLiu Zhe getFile(dir).mkdirs(); 3919edf8282SLiu Zhe app.start(); 392f46d12a6SLiu Zhe open(prepareData(file, dir)); 393f46d12a6SLiu Zhe new Condition() { 394f46d12a6SLiu Zhe @Override 395f46d12a6SLiu Zhe public boolean value() { 396f46d12a6SLiu Zhe try { 397f46d12a6SLiu Zhe String text = statusBar.getItemText(openIndicatorIndex); 398f46d12a6SLiu Zhe return text.matches(openIndicator); 399f46d12a6SLiu Zhe } catch (Exception e) { 400f46d12a6SLiu Zhe return false; 401f46d12a6SLiu Zhe } 402f46d12a6SLiu Zhe } 403f46d12a6SLiu Zhe 404f46d12a6SLiu Zhe }.waitForTrue("", 120, 1); 405f46d12a6SLiu Zhe sleep(2); 406f46d12a6SLiu Zhe insertPicture(picture); 4078969bfceSLiu Zhe sleep(5); 408f46d12a6SLiu Zhe assertEquals("File is modified", "*", statusBar.getItemText(saveIndicatorIndex)); 409f46d12a6SLiu Zhe app.dispatch(".uno:Save"); 410f46d12a6SLiu Zhe if (alienFormat) { 411f46d12a6SLiu Zhe alienFormatDlg.waitForExistence(3, 1); 412f46d12a6SLiu Zhe sleep(1); 413f46d12a6SLiu Zhe typeKeys("<enter>"); 414f46d12a6SLiu Zhe } 415f46d12a6SLiu Zhe 416f46d12a6SLiu Zhe long start = System.currentTimeMillis(); 417f46d12a6SLiu Zhe new Condition() { 418f46d12a6SLiu Zhe @Override 419f46d12a6SLiu Zhe public boolean value() { 420f46d12a6SLiu Zhe try { 421f46d12a6SLiu Zhe String text = statusBar.getItemText(saveIndicatorIndex); 422f46d12a6SLiu Zhe return " ".equals(text); 423f46d12a6SLiu Zhe } catch (Exception e) { 424f46d12a6SLiu Zhe return false; 425f46d12a6SLiu Zhe } 426f46d12a6SLiu Zhe } 427f46d12a6SLiu Zhe 428f46d12a6SLiu Zhe }.waitForTrue("", 120, INTERVAL); 429f46d12a6SLiu Zhe long end = System.currentTimeMillis(); 4308cce5abbSLiu Zhe addRecord(start, end); 431f46d12a6SLiu Zhe close(); 4329edf8282SLiu Zhe app.stop(); 433f46d12a6SLiu Zhe } 4348cce5abbSLiu Zhe 435f46d12a6SLiu Zhe } 43657caf934SLiu Zhe } 437