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 3757caf934SLiu Zhe import org.junit.AfterClass; 3857caf934SLiu Zhe import org.junit.BeforeClass; 3957caf934SLiu Zhe import org.junit.Rule; 4057caf934SLiu Zhe import org.junit.Test; 4157caf934SLiu Zhe import org.junit.rules.TestName; 4257caf934SLiu Zhe import org.openoffice.test.OpenOffice; 4357caf934SLiu Zhe import org.openoffice.test.common.Condition; 44*e4b83892SLiu Zhe import org.openoffice.test.common.DataSheet; 45f46d12a6SLiu Zhe import org.openoffice.test.common.GraphicsUtil; 4657caf934SLiu Zhe import org.openoffice.test.common.Logger; 4757caf934SLiu Zhe import org.openoffice.test.common.SystemUtil; 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 57*e4b83892SLiu Zhe private static DataSheet result; 5857caf934SLiu Zhe 59*e4b83892SLiu Zhe private static final double INTERVAL = 0.1; 6057caf934SLiu Zhe 6157caf934SLiu Zhe public Benchmark() { 6257caf934SLiu Zhe 6357caf934SLiu Zhe } 6457caf934SLiu Zhe 6557caf934SLiu Zhe @BeforeClass 6657caf934SLiu Zhe public static void beforeClass() throws Exception { 67*e4b83892SLiu Zhe result = new DataSheet(getFile("output/pvt_gui_benchmark.xml"), "benckmark"); 6857caf934SLiu Zhe OpenOffice.killAll(); 69*e4b83892SLiu Zhe result.addRow("Scenario", "No", "Consumed Time", "Memory(VSZ)", "Memory(RSS)", "Handles(Windows Only)"); 7057caf934SLiu Zhe } 7157caf934SLiu Zhe 7257caf934SLiu Zhe @AfterClass 7357caf934SLiu Zhe public static void afterClass() throws Exception { 7457caf934SLiu Zhe app.close(); 7557caf934SLiu Zhe } 7657caf934SLiu Zhe 7757caf934SLiu Zhe private HashMap<String, Object> getPerfData() { 7857caf934SLiu Zhe HashMap<String, Object> proccessInfo = SystemUtil.findProcess(".*(soffice\\.bin|soffice\\.exe .*-env).*"); 7957caf934SLiu Zhe String pid = (String) proccessInfo.get("pid"); 8057caf934SLiu Zhe return SystemUtil.getProcessPerfData(pid); 8157caf934SLiu Zhe } 8257caf934SLiu Zhe 8357caf934SLiu Zhe private void addRecord(int i, long start, long end) { 8457caf934SLiu Zhe HashMap<String, Object> perf = getPerfData(); 85*e4b83892SLiu Zhe result.addRow(testname.getMethodName(), i, (end - start), perf.get("vsz"), perf.get("rss"), perf.get("handles")); 8657caf934SLiu Zhe } 8757caf934SLiu Zhe 8857caf934SLiu Zhe @Test 8957caf934SLiu Zhe public void coolStartup() throws Exception { 9057caf934SLiu Zhe aoo.kill(); 9157caf934SLiu Zhe aoo.cleanUserInstallation(); 9257caf934SLiu Zhe aoo.start(); 9357caf934SLiu Zhe long start = System.currentTimeMillis(); 9457caf934SLiu Zhe startcenter.waitForExistence(120, INTERVAL); 9557caf934SLiu Zhe long end = System.currentTimeMillis(); 9657caf934SLiu Zhe sleep(2); 9757caf934SLiu Zhe addRecord(0, start, end); 9857caf934SLiu Zhe app.close(); 9957caf934SLiu Zhe } 10057caf934SLiu Zhe 10157caf934SLiu Zhe @Test 10257caf934SLiu Zhe public void warmStartup() throws Exception { 10357caf934SLiu Zhe for (int i = 0; i < 8; i++) { 10457caf934SLiu Zhe aoo.kill();//make sure app is closed 10557caf934SLiu Zhe aoo.start(); 10657caf934SLiu Zhe long start = System.currentTimeMillis(); 10757caf934SLiu Zhe startcenter.waitForExistence(120, INTERVAL); 10857caf934SLiu Zhe long end = System.currentTimeMillis(); 10957caf934SLiu Zhe sleep(2); 11057caf934SLiu Zhe addRecord(i, start, end); 11157caf934SLiu Zhe app.close(); 11257caf934SLiu Zhe } 11357caf934SLiu Zhe } 11457caf934SLiu Zhe 11557caf934SLiu Zhe @Test 11657caf934SLiu Zhe public void newTextDocument() { 11757caf934SLiu Zhe for (int i = 0; i < 8; i++) { 11857caf934SLiu Zhe aoo.kill();//make sure app is closed 11957caf934SLiu Zhe aoo.start(); 12057caf934SLiu Zhe startCenterWriterButton.waitForExistence(120, 1); 12157caf934SLiu Zhe sleep(2); 12257caf934SLiu Zhe startCenterWriterButton.click(0.5, 0.5); 12357caf934SLiu Zhe long start = System.currentTimeMillis(); 12457caf934SLiu Zhe writer.waitForExistence(60, INTERVAL); 12557caf934SLiu Zhe long end = System.currentTimeMillis(); 12657caf934SLiu Zhe sleep(2); 12757caf934SLiu Zhe addRecord(i, start, end); 12857caf934SLiu Zhe app.close(); 12957caf934SLiu Zhe } 13057caf934SLiu Zhe } 13157caf934SLiu Zhe 13257caf934SLiu Zhe @Test 13357caf934SLiu Zhe public void newSpreadsheet() { 13457caf934SLiu Zhe for (int i = 0; i < 8; i++) { 13557caf934SLiu Zhe aoo.kill();//make sure app is closed 13657caf934SLiu Zhe aoo.start(); 13757caf934SLiu Zhe startCenterCalcButton.waitForExistence(120, 1); 13857caf934SLiu Zhe sleep(2); 13957caf934SLiu Zhe startCenterCalcButton.click(0.5, 0.5); 14057caf934SLiu Zhe long start = System.currentTimeMillis(); 14157caf934SLiu Zhe calc.waitForExistence(60, INTERVAL); 14257caf934SLiu Zhe long end = System.currentTimeMillis(); 14357caf934SLiu Zhe sleep(2); 14457caf934SLiu Zhe addRecord(i, start, end); 14557caf934SLiu Zhe app.close(); 14657caf934SLiu Zhe } 14757caf934SLiu Zhe } 14857caf934SLiu Zhe 14957caf934SLiu Zhe @Test 15057caf934SLiu Zhe public void newPresentation() { 15157caf934SLiu Zhe for (int i = 0; i < 8; i++) { 15257caf934SLiu Zhe aoo.kill();//make sure app is closed 15357caf934SLiu Zhe aoo.start(); 15457caf934SLiu Zhe startCenterImpressButton.waitForExistence(120, 1); 15557caf934SLiu Zhe sleep(2); 15657caf934SLiu Zhe startCenterImpressButton.click(0.5, 0.5); 15757caf934SLiu Zhe sleep(1); 15857caf934SLiu Zhe presentationWizard.click(0.9, 0.95); 15957caf934SLiu Zhe long start = System.currentTimeMillis(); 16057caf934SLiu Zhe impress.waitForExistence(60, INTERVAL); 16157caf934SLiu Zhe long end = System.currentTimeMillis(); 16257caf934SLiu Zhe sleep(2); 16357caf934SLiu Zhe addRecord(i, start, end); 16457caf934SLiu Zhe app.close(); 16557caf934SLiu Zhe } 16657caf934SLiu Zhe } 16757caf934SLiu Zhe 16857caf934SLiu Zhe @Test 169f46d12a6SLiu Zhe public void loadFinishPlainODT() { 170f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.odt", "Page 1 / 23[0-9]{1}"); 17157caf934SLiu Zhe } 17257caf934SLiu Zhe 17357caf934SLiu Zhe @Test 174f46d12a6SLiu Zhe public void loadFinishPlainDOC() { 175*e4b83892SLiu Zhe loadFinish("pvt/plain_50p.doc", "Page i / 5[0-9]{1}"); 17657caf934SLiu Zhe } 17757caf934SLiu Zhe 17857caf934SLiu Zhe @Test 179f46d12a6SLiu Zhe public void loadFinishPlainDOCX() { 180f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.docx", "Page 1 / 19[0-9]{1}"); 18157caf934SLiu Zhe } 18257caf934SLiu Zhe 18357caf934SLiu Zhe @Test 18457caf934SLiu Zhe public void loadFinishPlainODS() { 185f46d12a6SLiu Zhe loadFinish("pvt/plain_11s.ods", "Sheet 1 / 11"); 18657caf934SLiu Zhe } 18757caf934SLiu Zhe 18857caf934SLiu Zhe @Test 189f46d12a6SLiu Zhe public void loadFinishPlainXLS() { 190f46d12a6SLiu Zhe loadFinish("pvt/plain_11s.xls", "Sheet 1 / 11"); 19157caf934SLiu Zhe } 19257caf934SLiu Zhe 19357caf934SLiu Zhe @Test 194f46d12a6SLiu Zhe public void loadFinishPlainXLSX() { 195f46d12a6SLiu Zhe loadFinish("pvt/plain_11s.xlsx", "Sheet 1 / 11"); 19657caf934SLiu Zhe } 19757caf934SLiu Zhe 19857caf934SLiu Zhe @Test 19957caf934SLiu Zhe public void loadFinishPlainODP() { 200f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.odp", "Slide 1 / 200"); 20157caf934SLiu Zhe } 20257caf934SLiu Zhe 20357caf934SLiu Zhe @Test 20457caf934SLiu Zhe public void loadFinishPlainPPT() { 205f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.ppt", "Slide 1 / 200"); 20657caf934SLiu Zhe } 20757caf934SLiu Zhe 20857caf934SLiu Zhe @Test 209f46d12a6SLiu Zhe public void loadFinishPlainPPTX() { 210f46d12a6SLiu Zhe loadFinish("pvt/plain_200p.pptx", "Slide 1 / 200"); 211f46d12a6SLiu Zhe } 212f46d12a6SLiu Zhe 213f46d12a6SLiu Zhe @Test 214f46d12a6SLiu Zhe public void loadFinishComplexDOC() { 215*e4b83892SLiu Zhe loadFinish("pvt/complex_300p.doc", "Page 1 / 3[0-9]{2}"); 216f46d12a6SLiu Zhe } 217f46d12a6SLiu Zhe 218f46d12a6SLiu Zhe @Test 219f46d12a6SLiu Zhe public void loadFinishComplexODT() { 220*e4b83892SLiu Zhe loadFinish("pvt/complex_800p.odt", "Page 1 / 8[0-9]{2}"); 221f46d12a6SLiu Zhe } 222f46d12a6SLiu Zhe 223f46d12a6SLiu Zhe @Test 224f46d12a6SLiu Zhe public void loadFinishComplexXLS() { 225f46d12a6SLiu Zhe loadFinish("pvt/sc_complex_13sh_4kcell.xls", "Sheet 2 / 13"); 226f46d12a6SLiu Zhe } 227f46d12a6SLiu Zhe 228f46d12a6SLiu Zhe @Test 229f46d12a6SLiu Zhe public void loadFinishComplexODS() { 230f46d12a6SLiu Zhe loadFinish("pvt/sc_complex_13sh_4kcell_new_odf1.2.ods", "Sheet 6 / 13"); 231f46d12a6SLiu Zhe } 232f46d12a6SLiu Zhe 233f46d12a6SLiu Zhe 234f46d12a6SLiu Zhe @Test 23557caf934SLiu Zhe public void loadFinishComplexODP() { 236f46d12a6SLiu Zhe loadFinish("pvt/sd_complex_51p_odf1.2.odp", "Slide 1 / 51"); 23757caf934SLiu Zhe } 23857caf934SLiu Zhe 23957caf934SLiu Zhe @Test 24057caf934SLiu Zhe public void loadFinishComplexPPT() { 241f46d12a6SLiu Zhe loadFinish("pvt/sd_complex_51p.ppt", "Slide 1 / 51"); 24257caf934SLiu Zhe } 24357caf934SLiu Zhe 24457caf934SLiu Zhe public void loadFinish(String file, final String indicator) { 245f46d12a6SLiu Zhe final int openIndicatorIndex = file.matches(".*\\.(odp|ppt|pptx)$") ? 4 : 0; 24657caf934SLiu Zhe String path = prepareData(file); 24757caf934SLiu Zhe aoo.kill(); 248f46d12a6SLiu Zhe app.start(); 249f46d12a6SLiu Zhe startcenter.waitForExistence(10, 1); 250f46d12a6SLiu Zhe sleep(2); // Give some seconds to AOO relax. We want data more stable. 25157caf934SLiu Zhe for (int i = 0; i < 8; i++) { 25257caf934SLiu Zhe app.dispatch(".uno:Open"); 25357caf934SLiu Zhe filePickerPath.setText(path); 254f46d12a6SLiu Zhe sleep(2); 255f46d12a6SLiu Zhe filePickerOpen.click(0.5, 0.5); 25657caf934SLiu Zhe long start = System.currentTimeMillis(); 25757caf934SLiu Zhe new Condition() { 25857caf934SLiu Zhe @Override 25957caf934SLiu Zhe public boolean value() { 260f46d12a6SLiu Zhe try { 261f46d12a6SLiu Zhe String text = statusBar.getItemText(openIndicatorIndex); 262f46d12a6SLiu Zhe return text.matches(indicator); 263f46d12a6SLiu Zhe } catch (Exception e) { 26457caf934SLiu Zhe return false; 265f46d12a6SLiu Zhe } 26657caf934SLiu Zhe } 26757caf934SLiu Zhe 26857caf934SLiu Zhe }.waitForTrue("", 120, INTERVAL); 26957caf934SLiu Zhe long end = System.currentTimeMillis(); 27057caf934SLiu Zhe sleep(2); 27157caf934SLiu Zhe addRecord(i, start, end); 272f46d12a6SLiu Zhe discard(); 27357caf934SLiu Zhe } 27457caf934SLiu Zhe 27557caf934SLiu Zhe app.close(); 27657caf934SLiu Zhe } 27757caf934SLiu Zhe 278f46d12a6SLiu Zhe @Test 279f46d12a6SLiu Zhe public void savePlainDOC() { 280*e4b83892SLiu Zhe save("pvt/plain_50p.doc", "Page i / 5[0-9]{1}"); 281f46d12a6SLiu Zhe } 28257caf934SLiu Zhe 283f46d12a6SLiu Zhe @Test 284f46d12a6SLiu Zhe public void savePlainODT() { 285f46d12a6SLiu Zhe save("pvt/plain_200p.odt", "Page 1 / 23[0-9]{1}"); 286f46d12a6SLiu Zhe } 287f46d12a6SLiu Zhe 288f46d12a6SLiu Zhe @Test 289f46d12a6SLiu Zhe public void saveComplexDOC() { 290*e4b83892SLiu Zhe save("pvt/complex_300p.doc", "Page 1 / 3[0-9]{2}"); 291f46d12a6SLiu Zhe } 292f46d12a6SLiu Zhe 293f46d12a6SLiu Zhe @Test 294f46d12a6SLiu Zhe public void saveComplexODT() { 295*e4b83892SLiu Zhe save("pvt/complex_800p.odt", "Page 1 / 8[0-9]{2}"); 296f46d12a6SLiu Zhe } 297f46d12a6SLiu Zhe 298f46d12a6SLiu Zhe @Test 299f46d12a6SLiu Zhe public void savePlainXLS() { 300f46d12a6SLiu Zhe save("pvt/plain_11s.xls", "Sheet 1 / 11"); 301f46d12a6SLiu Zhe } 302f46d12a6SLiu Zhe 303f46d12a6SLiu Zhe @Test 304f46d12a6SLiu Zhe public void savePlainODS() { 305f46d12a6SLiu Zhe save("pvt/plain_11s.ods", "Sheet 1 / 11"); 306f46d12a6SLiu Zhe } 307f46d12a6SLiu Zhe 308f46d12a6SLiu Zhe @Test 309f46d12a6SLiu Zhe public void saveComplexXLS() { 310f46d12a6SLiu Zhe save("pvt/sc_complex_13sh_4kcell.xls", "Sheet 2 / 13"); 311f46d12a6SLiu Zhe } 312f46d12a6SLiu Zhe 313f46d12a6SLiu Zhe @Test 314f46d12a6SLiu Zhe public void saveComplexODS() { 315f46d12a6SLiu Zhe save("pvt/sc_complex_13sh_4kcell_new_odf1.2.ods", "Sheet 6 / 13"); 316f46d12a6SLiu Zhe } 317f46d12a6SLiu Zhe 318f46d12a6SLiu Zhe @Test 319f46d12a6SLiu Zhe public void savePlainODP() { 320f46d12a6SLiu Zhe save("pvt/plain_200p.odp", "Slide 1 / 200"); 321f46d12a6SLiu Zhe } 322f46d12a6SLiu Zhe 323f46d12a6SLiu Zhe @Test 324f46d12a6SLiu Zhe public void savePlainPPT() { 325f46d12a6SLiu Zhe save("pvt/plain_200p.ppt", "Slide 1 / 200"); 326f46d12a6SLiu Zhe } 327f46d12a6SLiu Zhe 328f46d12a6SLiu Zhe @Test 329f46d12a6SLiu Zhe public void saveComplexODP() { 330f46d12a6SLiu Zhe save("pvt/sd_complex_51p_odf1.2.odp", "Slide 1 / 51"); 331f46d12a6SLiu Zhe } 332f46d12a6SLiu Zhe 333f46d12a6SLiu Zhe @Test 334f46d12a6SLiu Zhe public void saveComplexPPT() { 335f46d12a6SLiu Zhe save("pvt/sd_complex_51p.ppt", "Slide 1 / 51"); 336f46d12a6SLiu Zhe } 337f46d12a6SLiu Zhe 338f46d12a6SLiu Zhe public void save(String file, final String openIndicator) { 339f46d12a6SLiu Zhe boolean alienFormat = file.matches(".*\\.(doc|xls|ppt|docx|xlsx|pptx)$"); 340f46d12a6SLiu Zhe final int openIndicatorIndex = file.matches(".*\\.(odp|ppt|pptx)$") ? 4 : 0; 341f46d12a6SLiu Zhe final int saveIndicatorIndex = file.matches(".*\\.(odt|doc|docx)$") ? 5 : file.matches(".*\\.(ods|xls|xlsx)$") ? 4 : 2; 342f46d12a6SLiu Zhe aoo.kill(); 343f46d12a6SLiu Zhe app.start(); 344f46d12a6SLiu Zhe String picture = prepareData("image/red_64x64.bmp"); 345f46d12a6SLiu Zhe for (int i = 0; i < 8; i++) { 346f46d12a6SLiu Zhe String dir = "temp/file" + i; 347f46d12a6SLiu Zhe getFile(dir).mkdirs(); 348f46d12a6SLiu Zhe open(prepareData(file, dir)); 349f46d12a6SLiu Zhe new Condition() { 350f46d12a6SLiu Zhe @Override 351f46d12a6SLiu Zhe public boolean value() { 352f46d12a6SLiu Zhe try { 353f46d12a6SLiu Zhe String text = statusBar.getItemText(openIndicatorIndex); 354f46d12a6SLiu Zhe return text.matches(openIndicator); 355f46d12a6SLiu Zhe } catch (Exception e) { 356f46d12a6SLiu Zhe return false; 357f46d12a6SLiu Zhe } 358f46d12a6SLiu Zhe } 359f46d12a6SLiu Zhe 360f46d12a6SLiu Zhe }.waitForTrue("", 120, 1); 361f46d12a6SLiu Zhe sleep(2); 362f46d12a6SLiu Zhe insertPicture(picture); 363f46d12a6SLiu Zhe sleep(3); 364f46d12a6SLiu Zhe assertEquals("File is modified", "*", statusBar.getItemText(saveIndicatorIndex)); 365f46d12a6SLiu Zhe app.dispatch(".uno:Save"); 366f46d12a6SLiu Zhe if (alienFormat) { 367f46d12a6SLiu Zhe alienFormatDlg.waitForExistence(3, 1); 368f46d12a6SLiu Zhe sleep(1); 369f46d12a6SLiu Zhe typeKeys("<enter>"); 370f46d12a6SLiu Zhe } 371f46d12a6SLiu Zhe 372f46d12a6SLiu Zhe long start = System.currentTimeMillis(); 373f46d12a6SLiu Zhe new Condition() { 374f46d12a6SLiu Zhe @Override 375f46d12a6SLiu Zhe public boolean value() { 376f46d12a6SLiu Zhe try { 377f46d12a6SLiu Zhe String text = statusBar.getItemText(saveIndicatorIndex); 378f46d12a6SLiu Zhe return " ".equals(text); 379f46d12a6SLiu Zhe } catch (Exception e) { 380f46d12a6SLiu Zhe return false; 381f46d12a6SLiu Zhe } 382f46d12a6SLiu Zhe } 383f46d12a6SLiu Zhe 384f46d12a6SLiu Zhe }.waitForTrue("", 120, INTERVAL); 385f46d12a6SLiu Zhe long end = System.currentTimeMillis(); 386f46d12a6SLiu Zhe sleep(2); 387f46d12a6SLiu Zhe addRecord(i, start, end); 388f46d12a6SLiu Zhe close(); 389f46d12a6SLiu Zhe } 390f46d12a6SLiu Zhe 391f46d12a6SLiu Zhe app.close(); 392f46d12a6SLiu Zhe } 393f46d12a6SLiu Zhe 394f46d12a6SLiu Zhe @Test 395f46d12a6SLiu Zhe public void slideShow() { 396f46d12a6SLiu Zhe aoo.kill(); 397f46d12a6SLiu Zhe app.start(); 398f46d12a6SLiu Zhe String path = prepareData("pvt/sd_slideshow.odp"); 399f46d12a6SLiu Zhe final Rectangle rect = GraphicsUtil.getScreenRectangle(); 400f46d12a6SLiu Zhe // when slide show is running, top-center area will be filled with green 401f46d12a6SLiu Zhe rect.setRect(rect.getCenterX(), 2, 2, 2); 402f46d12a6SLiu Zhe for (int i = 0; i < 8; i++) { 403f46d12a6SLiu Zhe open(path); 404f46d12a6SLiu Zhe impress.waitForExistence(60, 1); 405f46d12a6SLiu Zhe sleep(2); 406f46d12a6SLiu Zhe assertFalse("Slideshow control exists", slideShow.exists()); 407f46d12a6SLiu Zhe assertFalse("Slideshow is not started", GraphicsUtil.isFilledWith(0xFF00FF00, rect)); 408f46d12a6SLiu Zhe typeKeys("<F5>"); 409f46d12a6SLiu Zhe long start = System.currentTimeMillis(); 410f46d12a6SLiu Zhe new Condition() { 411f46d12a6SLiu Zhe @Override 412f46d12a6SLiu Zhe public boolean value() { 413f46d12a6SLiu Zhe return GraphicsUtil.isFilledWith(0xFF00FF00, rect); 414f46d12a6SLiu Zhe } 415f46d12a6SLiu Zhe 416f46d12a6SLiu Zhe }.waitForTrue("", 120, INTERVAL); 417f46d12a6SLiu Zhe long end = System.currentTimeMillis(); 418f46d12a6SLiu Zhe sleep(2); 419f46d12a6SLiu Zhe addRecord(i, start, end); 420f46d12a6SLiu Zhe slideShow.typeKeys("<esc>"); 421f46d12a6SLiu Zhe sleep(2); 422f46d12a6SLiu Zhe close(); 423f46d12a6SLiu Zhe } 424f46d12a6SLiu Zhe app.close(); 425f46d12a6SLiu Zhe } 42657caf934SLiu Zhe } 427