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; 3957caf934SLiu Zhe import org.junit.BeforeClass; 4057caf934SLiu Zhe import org.junit.Rule; 4157caf934SLiu Zhe import org.junit.Test; 4257caf934SLiu Zhe import org.junit.rules.TestName; 4357caf934SLiu Zhe import org.openoffice.test.OpenOffice; 4457caf934SLiu Zhe import org.openoffice.test.common.Condition; 45e4b83892SLiu Zhe import org.openoffice.test.common.DataSheet; 46f46d12a6SLiu Zhe import org.openoffice.test.common.GraphicsUtil; 4757caf934SLiu Zhe import org.openoffice.test.common.Logger; 4857caf934SLiu Zhe 4957caf934SLiu Zhe 5057caf934SLiu Zhe public class Benchmark { 5157caf934SLiu Zhe @Rule 5257caf934SLiu Zhe public Logger log = Logger.getLogger(this); 5357caf934SLiu Zhe 5457caf934SLiu Zhe @Rule 5557caf934SLiu Zhe public TestName testname = new TestName(); 5657caf934SLiu Zhe 57e4b83892SLiu Zhe private static DataSheet result; 5857caf934SLiu Zhe 59e4b83892SLiu Zhe private static final double INTERVAL = 0.1; 6057caf934SLiu Zhe 61*8969bfceSLiu Zhe private static int repeat = 8; 628cce5abbSLiu Zhe 638cce5abbSLiu Zhe private int i = 0; 649edf8282SLiu Zhe 6557caf934SLiu Zhe public Benchmark() { 6657caf934SLiu Zhe 6757caf934SLiu Zhe } 6857caf934SLiu Zhe 6957caf934SLiu Zhe @BeforeClass 7057caf934SLiu Zhe public static void beforeClass() throws Exception { 7157caf934SLiu Zhe OpenOffice.killAll(); 72*8969bfceSLiu Zhe result = new DataSheet(getFile("output/" + Benchmark.class.getName() + ".xml")); 739edf8282SLiu Zhe result.addRow("data", "Scenario", "No", "Consumed Time", "Memory(VSZ)", "Memory(RSS)", "Handles(Windows Only)"); 7457caf934SLiu Zhe } 7557caf934SLiu Zhe 7657caf934SLiu Zhe @AfterClass 7757caf934SLiu Zhe public static void afterClass() throws Exception { 789edf8282SLiu Zhe app.stop(); 7957caf934SLiu Zhe } 8057caf934SLiu Zhe 818cce5abbSLiu Zhe @After 828cce5abbSLiu Zhe public void after() { 838cce5abbSLiu Zhe if (i < repeat) 848cce5abbSLiu Zhe result.addRow("data", testname.getMethodName(), i, "err", "err", "err", "err", "err"); 858cce5abbSLiu Zhe } 868cce5abbSLiu Zhe 878cce5abbSLiu Zhe private void addRecord(long start, long end) { 889edf8282SLiu Zhe sleep(2); 899edf8282SLiu Zhe HashMap<String, Object> perf = aoo.getPerfData(); 909edf8282SLiu Zhe result.addRow("data", testname.getMethodName(), i, (end - start), perf.get("vsz"), perf.get("rss"), perf.get("handles")); 9157caf934SLiu Zhe } 9257caf934SLiu Zhe 9357caf934SLiu Zhe @Test 9457caf934SLiu Zhe public void coolStartup() throws Exception { 959edf8282SLiu Zhe app.stop(); 968cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 9757caf934SLiu Zhe aoo.cleanUserInstallation(); 989edf8282SLiu Zhe assertFalse("User profile exists", aoo.getUserInstallation().exists()); 9957caf934SLiu Zhe aoo.start(); 10057caf934SLiu Zhe long start = System.currentTimeMillis(); 10157caf934SLiu Zhe startcenter.waitForExistence(120, INTERVAL); 10257caf934SLiu Zhe long end = System.currentTimeMillis(); 1038cce5abbSLiu Zhe addRecord(start, end); 1049edf8282SLiu Zhe app.quit(); 1059edf8282SLiu Zhe } 1068cce5abbSLiu Zhe 10757caf934SLiu Zhe } 10857caf934SLiu Zhe 10957caf934SLiu Zhe @Test 11057caf934SLiu Zhe public void warmStartup() throws Exception { 1119edf8282SLiu Zhe // Make sure we has generated user profile 1129edf8282SLiu Zhe app.start(true); 1139edf8282SLiu Zhe app.quit(); 1149edf8282SLiu Zhe 1158cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1169edf8282SLiu Zhe assertTrue("User profile exists", aoo.getUserInstallation().exists()); 11757caf934SLiu Zhe aoo.start(); 11857caf934SLiu Zhe long start = System.currentTimeMillis(); 11957caf934SLiu Zhe startcenter.waitForExistence(120, INTERVAL); 12057caf934SLiu Zhe long end = System.currentTimeMillis(); 1218cce5abbSLiu Zhe addRecord(start, end); 1229edf8282SLiu Zhe app.quit(); 12357caf934SLiu Zhe } 1248cce5abbSLiu Zhe 12557caf934SLiu Zhe } 12657caf934SLiu Zhe 12757caf934SLiu Zhe @Test 12857caf934SLiu Zhe public void newTextDocument() { 1299edf8282SLiu Zhe app.start(true); 1309edf8282SLiu Zhe app.quit(); 1319edf8282SLiu Zhe 1328cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1339edf8282SLiu Zhe app.start(); 13457caf934SLiu Zhe startCenterWriterButton.click(0.5, 0.5); 13557caf934SLiu Zhe long start = System.currentTimeMillis(); 13657caf934SLiu Zhe writer.waitForExistence(60, INTERVAL); 13757caf934SLiu Zhe long end = System.currentTimeMillis(); 1388cce5abbSLiu Zhe addRecord(start, end); 1399edf8282SLiu Zhe app.quit(); 14057caf934SLiu Zhe } 1418cce5abbSLiu Zhe 14257caf934SLiu Zhe } 14357caf934SLiu Zhe 14457caf934SLiu Zhe @Test 14557caf934SLiu Zhe public void newSpreadsheet() { 1469edf8282SLiu Zhe app.start(true); 1479edf8282SLiu Zhe app.quit(); 1488cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1499edf8282SLiu Zhe app.start(); 15057caf934SLiu Zhe startCenterCalcButton.click(0.5, 0.5); 15157caf934SLiu Zhe long start = System.currentTimeMillis(); 15257caf934SLiu Zhe calc.waitForExistence(60, INTERVAL); 15357caf934SLiu Zhe long end = System.currentTimeMillis(); 1548cce5abbSLiu Zhe addRecord(start, end); 1559edf8282SLiu Zhe app.quit(); 15657caf934SLiu Zhe } 1578cce5abbSLiu Zhe 15857caf934SLiu Zhe } 15957caf934SLiu Zhe 16057caf934SLiu Zhe @Test 16157caf934SLiu Zhe public void newPresentation() { 1629edf8282SLiu Zhe app.start(true); 1639edf8282SLiu Zhe app.quit(); 1648cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1659edf8282SLiu Zhe app.start(); 16657caf934SLiu Zhe startCenterImpressButton.click(0.5, 0.5); 16757caf934SLiu Zhe presentationWizard.click(0.9, 0.95); 16857caf934SLiu Zhe long start = System.currentTimeMillis(); 16957caf934SLiu Zhe impress.waitForExistence(60, INTERVAL); 17057caf934SLiu Zhe long end = System.currentTimeMillis(); 1718cce5abbSLiu Zhe addRecord(start, end); 1729edf8282SLiu Zhe app.quit(); 1739edf8282SLiu Zhe } 1748cce5abbSLiu Zhe 1759edf8282SLiu Zhe } 1769edf8282SLiu Zhe 1779edf8282SLiu Zhe @Test 1789edf8282SLiu Zhe public void slideShow() { 1799edf8282SLiu Zhe app.start(true); 1809edf8282SLiu Zhe app.quit(); 1819edf8282SLiu Zhe 1829edf8282SLiu Zhe String path = prepareData("pvt/slideshow.odp"); 1839edf8282SLiu Zhe final Rectangle rect = GraphicsUtil.getScreenRectangle(); 1849edf8282SLiu Zhe // when slide show is running, top-center area will be filled with green 1859edf8282SLiu Zhe rect.setRect(rect.getCenterX(), 2, 2, 2); 1868cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 1879edf8282SLiu Zhe app.start(); 1889edf8282SLiu Zhe open(path); 1899edf8282SLiu Zhe impress.waitForExistence(60, 1); 1909edf8282SLiu Zhe sleep(2); 1919edf8282SLiu Zhe assertFalse("Slideshow control exists", slideShow.exists()); 1929edf8282SLiu Zhe assertFalse("Slideshow is not started", GraphicsUtil.isFilledWith(0xFF00FF00, rect)); 1939edf8282SLiu Zhe typeKeys("<F5>"); 1949edf8282SLiu Zhe long start = System.currentTimeMillis(); 1959edf8282SLiu Zhe new Condition() { 1969edf8282SLiu Zhe @Override 1979edf8282SLiu Zhe public boolean value() { 1989edf8282SLiu Zhe return GraphicsUtil.isFilledWith(0xFF00FF00, rect); 1999edf8282SLiu Zhe } 2009edf8282SLiu Zhe 2019edf8282SLiu Zhe }.waitForTrue("", 120, INTERVAL); 2029edf8282SLiu Zhe long end = System.currentTimeMillis(); 2038cce5abbSLiu Zhe addRecord(start, end); 2049edf8282SLiu Zhe slideShow.typeKeys("<esc>"); 2059edf8282SLiu Zhe sleep(2); 2069edf8282SLiu Zhe app.quit(); 20757caf934SLiu Zhe } 2088cce5abbSLiu Zhe 20957caf934SLiu Zhe } 21057caf934SLiu Zhe 21157caf934SLiu Zhe @Test 212f46d12a6SLiu Zhe public void loadFinishPlainODT() { 213f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.odt", "Page 1 / 23[0-9]{1}"); 21457caf934SLiu Zhe } 21557caf934SLiu Zhe 21657caf934SLiu Zhe @Test 217f46d12a6SLiu Zhe public void loadFinishPlainDOC() { 218e4b83892SLiu Zhe loadFinish("pvt/plain_50p.doc", "Page i / 5[0-9]{1}"); 21957caf934SLiu Zhe } 22057caf934SLiu Zhe 22157caf934SLiu Zhe @Test 222f46d12a6SLiu Zhe public void loadFinishPlainDOCX() { 2238cce5abbSLiu Zhe loadFinish("pvt/plain_200p.docx", "Page 1 / 1[8-9]{1}[0-9]{1}"); 22457caf934SLiu Zhe } 22557caf934SLiu Zhe 22657caf934SLiu Zhe @Test 22757caf934SLiu Zhe public void loadFinishPlainODS() { 228f46d12a6SLiu Zhe loadFinish("pvt/plain_11s.ods", "Sheet 1 / 11"); 22957caf934SLiu Zhe } 23057caf934SLiu Zhe 23157caf934SLiu Zhe @Test 232f46d12a6SLiu Zhe public void loadFinishPlainXLS() { 233f46d12a6SLiu Zhe loadFinish("pvt/plain_11s.xls", "Sheet 1 / 11"); 23457caf934SLiu Zhe } 23557caf934SLiu Zhe 23657caf934SLiu Zhe @Test 237f46d12a6SLiu Zhe public void loadFinishPlainXLSX() { 238f46d12a6SLiu Zhe loadFinish("pvt/plain_11s.xlsx", "Sheet 1 / 11"); 23957caf934SLiu Zhe } 24057caf934SLiu Zhe 24157caf934SLiu Zhe @Test 24257caf934SLiu Zhe public void loadFinishPlainODP() { 243f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.odp", "Slide 1 / 200"); 24457caf934SLiu Zhe } 24557caf934SLiu Zhe 24657caf934SLiu Zhe @Test 24757caf934SLiu Zhe public void loadFinishPlainPPT() { 248f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.ppt", "Slide 1 / 200"); 24957caf934SLiu Zhe } 25057caf934SLiu Zhe 25157caf934SLiu Zhe @Test 252f46d12a6SLiu Zhe public void loadFinishPlainPPTX() { 253f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.pptx", "Slide 1 / 200"); 254f46d12a6SLiu Zhe } 255f46d12a6SLiu Zhe 256f46d12a6SLiu Zhe @Test 257f46d12a6SLiu Zhe public void loadFinishComplexDOC() { 258e4b83892SLiu Zhe loadFinish("pvt/complex_300p.doc", "Page 1 / 3[0-9]{2}"); 259f46d12a6SLiu Zhe } 260f46d12a6SLiu Zhe 261f46d12a6SLiu Zhe @Test 2629edf8282SLiu Zhe public void loadFinishComplexDOCX() { 263*8969bfceSLiu Zhe loadFinish("pvt/complex_400p.docx", "Page 1 / 3[2-9]{2}"); 2649edf8282SLiu Zhe } 2659edf8282SLiu Zhe 2669edf8282SLiu Zhe @Test 267f46d12a6SLiu Zhe public void loadFinishComplexODT() { 268e4b83892SLiu Zhe loadFinish("pvt/complex_800p.odt", "Page 1 / 8[0-9]{2}"); 269f46d12a6SLiu Zhe } 270f46d12a6SLiu Zhe 271f46d12a6SLiu Zhe @Test 272f46d12a6SLiu Zhe public void loadFinishComplexODS() { 273*8969bfceSLiu Zhe loadFinish("pvt/complex_19s.ods", "Sheet 8 / 19"); 274f46d12a6SLiu Zhe } 275f46d12a6SLiu Zhe 276f46d12a6SLiu Zhe @Test 2778cce5abbSLiu Zhe public void loadFinishComplexXLS() { 2788cce5abbSLiu Zhe loadFinish("pvt/complex_29s.xls", "Sheet 2 / 29"); 2798cce5abbSLiu Zhe } 2808cce5abbSLiu Zhe 2818cce5abbSLiu Zhe @Test 2828cce5abbSLiu Zhe public void loadFinishComplexXLSX() { 2838cce5abbSLiu Zhe loadFinish("pvt/complex_29s.xlsx", "Sheet 29 / 29"); 2848cce5abbSLiu Zhe } 2858cce5abbSLiu Zhe 2868cce5abbSLiu Zhe @Test 28757caf934SLiu Zhe public void loadFinishComplexODP() { 2889edf8282SLiu Zhe loadFinish("pvt/complex_150p.odp", "Slide 1 / 150"); 28957caf934SLiu Zhe } 29057caf934SLiu Zhe 2918cce5abbSLiu Zhe @Test 2928cce5abbSLiu Zhe public void loadFinishComplexPPT() { 2938cce5abbSLiu Zhe loadFinish("pvt/complex_100p.ppt", "Slide 1 / 100"); 2948cce5abbSLiu Zhe } 2958cce5abbSLiu Zhe 2968cce5abbSLiu Zhe @Test 2978cce5abbSLiu Zhe public void loadFinishComplexPPTX() { 2988cce5abbSLiu Zhe loadFinish("pvt/complex_100p.pptx", "Slide 1 / 100"); 2998cce5abbSLiu Zhe } 3008cce5abbSLiu Zhe 30157caf934SLiu Zhe public void loadFinish(String file, final String indicator) { 302f46d12a6SLiu Zhe final int openIndicatorIndex = file.matches(".*\\.(odp|ppt|pptx)$") ? 4 : 0; 30357caf934SLiu Zhe String path = prepareData(file); 3049edf8282SLiu Zhe app.stop(); 3058cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 3069edf8282SLiu Zhe app.start(); 30757caf934SLiu Zhe app.dispatch(".uno:Open"); 30857caf934SLiu Zhe filePickerPath.setText(path); 3099edf8282SLiu Zhe sleep(1); 310f46d12a6SLiu Zhe filePickerOpen.click(0.5, 0.5); 31157caf934SLiu Zhe long start = System.currentTimeMillis(); 31257caf934SLiu Zhe new Condition() { 31357caf934SLiu Zhe @Override 31457caf934SLiu Zhe public boolean value() { 315f46d12a6SLiu Zhe try { 316f46d12a6SLiu Zhe String text = statusBar.getItemText(openIndicatorIndex); 317f46d12a6SLiu Zhe return text.matches(indicator); 318f46d12a6SLiu Zhe } catch (Exception e) { 31957caf934SLiu Zhe return false; 320f46d12a6SLiu Zhe } 32157caf934SLiu Zhe } 32257caf934SLiu Zhe 32357caf934SLiu Zhe }.waitForTrue("", 120, INTERVAL); 32457caf934SLiu Zhe long end = System.currentTimeMillis(); 3258cce5abbSLiu Zhe addRecord(start, end); 326f46d12a6SLiu Zhe discard(); 3279edf8282SLiu Zhe app.quit(); 32857caf934SLiu Zhe } 32957caf934SLiu Zhe 330f46d12a6SLiu Zhe } 33157caf934SLiu Zhe 332f46d12a6SLiu Zhe @Test 333f46d12a6SLiu Zhe public void savePlainODT() { 334f46d12a6SLiu Zhe save("pvt/plain_200p.odt", "Page 1 / 23[0-9]{1}"); 335f46d12a6SLiu Zhe } 336f46d12a6SLiu Zhe 337f46d12a6SLiu Zhe @Test 3388cce5abbSLiu Zhe public void savePlainDOC() { 3398cce5abbSLiu Zhe save("pvt/plain_50p.doc", "Page i / 5[0-9]{1}"); 340f46d12a6SLiu Zhe } 341f46d12a6SLiu Zhe 342f46d12a6SLiu Zhe @Test 343f46d12a6SLiu Zhe public void savePlainODS() { 344f46d12a6SLiu Zhe save("pvt/plain_11s.ods", "Sheet 1 / 11"); 345f46d12a6SLiu Zhe } 346f46d12a6SLiu Zhe 347f46d12a6SLiu Zhe @Test 3488cce5abbSLiu Zhe public void savePlainXLS() { 3498cce5abbSLiu Zhe save("pvt/plain_11s.xls", "Sheet 1 / 11"); 350f46d12a6SLiu Zhe } 351f46d12a6SLiu Zhe 352f46d12a6SLiu Zhe @Test 353f46d12a6SLiu Zhe public void savePlainODP() { 354f46d12a6SLiu Zhe save("pvt/plain_200p.odp", "Slide 1 / 200"); 355f46d12a6SLiu Zhe } 356f46d12a6SLiu Zhe 357f46d12a6SLiu Zhe @Test 358f46d12a6SLiu Zhe public void savePlainPPT() { 359f46d12a6SLiu Zhe save("pvt/plain_200p.ppt", "Slide 1 / 200"); 360f46d12a6SLiu Zhe } 361f46d12a6SLiu Zhe 362f46d12a6SLiu Zhe @Test 3638cce5abbSLiu Zhe public void saveComplexODT() { 3648cce5abbSLiu Zhe save("pvt/complex_800p.odt", "Page 1 / 8[0-9]{2}"); 3658cce5abbSLiu Zhe } 3668cce5abbSLiu Zhe 3678cce5abbSLiu Zhe @Test 3688cce5abbSLiu Zhe public void saveComplexDOC() { 3698cce5abbSLiu Zhe save("pvt/complex_300p.doc", "Page 1 / 3[0-9]{2}"); 3708cce5abbSLiu Zhe } 3718cce5abbSLiu Zhe 3728cce5abbSLiu Zhe @Test 3738cce5abbSLiu Zhe public void saveComplexODS() { 3748cce5abbSLiu Zhe save("pvt/complex_19s.ods", "Sheet 8 / 19"); 3758cce5abbSLiu Zhe } 3768cce5abbSLiu Zhe 3778cce5abbSLiu Zhe @Test 3788cce5abbSLiu Zhe public void saveComplexXLS() { 3798cce5abbSLiu Zhe save("pvt/complex_29s.xls", "Sheet 2 / 29"); 3808cce5abbSLiu Zhe } 3818cce5abbSLiu Zhe 3828cce5abbSLiu Zhe @Test 383f46d12a6SLiu Zhe public void saveComplexODP() { 3849edf8282SLiu Zhe save("pvt/complex_150p.odp", "Slide 1 / 150"); 385f46d12a6SLiu Zhe } 386f46d12a6SLiu Zhe 3878cce5abbSLiu Zhe @Test 3888cce5abbSLiu Zhe public void saveComplexPPT() { 3898cce5abbSLiu Zhe save("pvt/complex_100p.ppt", "Slide 1 / 100"); 3908cce5abbSLiu Zhe } 3918cce5abbSLiu Zhe 392f46d12a6SLiu Zhe public void save(String file, final String openIndicator) { 393f46d12a6SLiu Zhe boolean alienFormat = file.matches(".*\\.(doc|xls|ppt|docx|xlsx|pptx)$"); 394f46d12a6SLiu Zhe final int openIndicatorIndex = file.matches(".*\\.(odp|ppt|pptx)$") ? 4 : 0; 395f46d12a6SLiu Zhe final int saveIndicatorIndex = file.matches(".*\\.(odt|doc|docx)$") ? 5 : file.matches(".*\\.(ods|xls|xlsx)$") ? 4 : 2; 3969edf8282SLiu Zhe app.stop(); 397f46d12a6SLiu Zhe String picture = prepareData("image/red_64x64.bmp"); 3988cce5abbSLiu Zhe for (i = 0; i < repeat; i++) { 399f46d12a6SLiu Zhe String dir = "temp/file" + i; 400f46d12a6SLiu Zhe getFile(dir).mkdirs(); 4019edf8282SLiu Zhe app.start(); 402f46d12a6SLiu Zhe open(prepareData(file, dir)); 403f46d12a6SLiu Zhe new Condition() { 404f46d12a6SLiu Zhe @Override 405f46d12a6SLiu Zhe public boolean value() { 406f46d12a6SLiu Zhe try { 407f46d12a6SLiu Zhe String text = statusBar.getItemText(openIndicatorIndex); 408f46d12a6SLiu Zhe return text.matches(openIndicator); 409f46d12a6SLiu Zhe } catch (Exception e) { 410f46d12a6SLiu Zhe return false; 411f46d12a6SLiu Zhe } 412f46d12a6SLiu Zhe } 413f46d12a6SLiu Zhe 414f46d12a6SLiu Zhe }.waitForTrue("", 120, 1); 415f46d12a6SLiu Zhe sleep(2); 416f46d12a6SLiu Zhe insertPicture(picture); 417*8969bfceSLiu Zhe sleep(5); 418f46d12a6SLiu Zhe assertEquals("File is modified", "*", statusBar.getItemText(saveIndicatorIndex)); 419f46d12a6SLiu Zhe app.dispatch(".uno:Save"); 420f46d12a6SLiu Zhe if (alienFormat) { 421f46d12a6SLiu Zhe alienFormatDlg.waitForExistence(3, 1); 422f46d12a6SLiu Zhe sleep(1); 423f46d12a6SLiu Zhe typeKeys("<enter>"); 424f46d12a6SLiu Zhe } 425f46d12a6SLiu Zhe 426f46d12a6SLiu Zhe long start = System.currentTimeMillis(); 427f46d12a6SLiu Zhe new Condition() { 428f46d12a6SLiu Zhe @Override 429f46d12a6SLiu Zhe public boolean value() { 430f46d12a6SLiu Zhe try { 431f46d12a6SLiu Zhe String text = statusBar.getItemText(saveIndicatorIndex); 432f46d12a6SLiu Zhe return " ".equals(text); 433f46d12a6SLiu Zhe } catch (Exception e) { 434f46d12a6SLiu Zhe return false; 435f46d12a6SLiu Zhe } 436f46d12a6SLiu Zhe } 437f46d12a6SLiu Zhe 438f46d12a6SLiu Zhe }.waitForTrue("", 120, INTERVAL); 439f46d12a6SLiu Zhe long end = System.currentTimeMillis(); 4408cce5abbSLiu Zhe addRecord(start, end); 441f46d12a6SLiu Zhe close(); 4429edf8282SLiu Zhe app.stop(); 443f46d12a6SLiu Zhe } 4448cce5abbSLiu Zhe 445f46d12a6SLiu Zhe } 44657caf934SLiu Zhe } 447