Author: liuzhe Date: Wed Aug 22 08:50:37 2012 New Revision: 1375948 URL: http://svn.apache.org/viewvc?rev=1375948&view=rev Log: #120653# - SVT SW case 1 Patch by: Liu Yi Xuan <liuyixuan....@gmail.com> Review by: Liu Zhe <aliu...@gmail.com>
Added: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/LongRun.java - copied, changed from r1374892, incubator/ooo/trunk/main/test/testgui/source/testcase/gui/LongRun.java incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnNewSW.java Modified: incubator/ooo/trunk/main/test/testgui/source/testlib/gui/UIMap.java Copied: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/LongRun.java (from r1374892, incubator/ooo/trunk/main/test/testgui/source/testcase/gui/LongRun.java) URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/LongRun.java?p2=incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/LongRun.java&p1=incubator/ooo/trunk/main/test/testgui/source/testcase/gui/LongRun.java&r1=1374892&r2=1375948&rev=1375948&view=diff ============================================================================== --- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/LongRun.java (original) +++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/LongRun.java Wed Aug 22 08:50:37 2012 @@ -19,7 +19,7 @@ * *************************************************************/ -package testcase.gui; +package testcase.gui.svt.sw; import static org.openoffice.test.common.Testspace.*; import static org.junit.Assert.*; import static org.openoffice.test.vcl.Tester.*; @@ -61,10 +61,9 @@ public class LongRun { */ @Before public void setUp() throws Exception { - OpenOffice.killAll(); - app.start(); + app.start(true); result = new PrintStream(new FileOutputStream(Testspace.getFile("output/longrun.csv"))); - HashMap<String, Object> proccessInfo = SystemUtil.findProcess(".*soffice\\.bin.*"); + HashMap<String, Object> proccessInfo = SystemUtil.findProcess(".*(soffice\\.bin|soffice.*-env).*"); pid = (String)proccessInfo.get("pid"); result.println("Iterator,Time,Memory(KB),CPU(%)"); LOG.info("Result will be saved to " + Testspace.getPath("output/longrun.csv")); Added: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnNewSW.java URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnNewSW.java?rev=1375948&view=auto ============================================================================== --- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnNewSW.java (added) +++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnNewSW.java Wed Aug 22 08:50:37 2012 @@ -0,0 +1,209 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +/** + * + */ +package testcase.gui.svt.sw; + +import static org.openoffice.test.vcl.Tester.sleep; +import static testlib.gui.AppUtil.submitSaveDlg; +import static testlib.gui.UIMap.ActiveMsgBox; +import static testlib.gui.UIMap.Bullet; +import static testlib.gui.UIMap.Change; +import static testlib.gui.UIMap.InsertIndexDlg; +import static testlib.gui.UIMap.StyleAndFormattingDlg; +import static testlib.gui.UIMap.StyleAndFormattingList; +import static testlib.gui.UIMap.SuggestionList; +import static testlib.gui.UIMap.app; +import static testlib.gui.UIMap.startcenter; +import static testlib.gui.UIMap.writer; +import static testlib.gui.UIMap.writer_FrameDlg; + +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.util.HashMap; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.openoffice.test.common.FileUtil; +import org.openoffice.test.common.SystemUtil; +import org.openoffice.test.common.Testspace; + +import testlib.gui.Log; + +public class OperationOnNewSW { + @Rule + public Log LOG = new Log(); + + private PrintStream result = null; + + private String pid = null; + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + app.start(true); + result = new PrintStream(new FileOutputStream(Testspace.getFile("output/svt_sw_new.csv"))); + HashMap<String, Object> proccessInfo = SystemUtil.findProcess(".*(soffice\\.bin|soffice.*-env).*"); + pid = (String)proccessInfo.get("pid"); + result.println("Iterator,Time,Memory(KB),CPU(%)"); + LOG.info("Result will be saved to " + Testspace.getPath("output/longrun.csv")); + } + + @After + public void tearDown() throws Exception { + app.close(); + result.close(); + } + + @Test + public void operationOnNewSW() throws Exception { + for(int i = 0; i < 1000; i++) + { + startcenter.menuItem("File->New->Text Document").select(); + +// Input words (Duplicate Formatting) and set numbering and bullet. + writer.typeKeys("this is a wonderful world"); + writer.typeKeys("<enter>"); + sleep(3); + writer.typeKeys("this is a beautiful world"); + app.dispatch(".uno:SelectAll"); + writer.menuItem("Format->Bullets and Numbering...").select(); + sleep(3); + Bullet.ok(); + writer.typeKeys("<ctrl z"); + sleep(1); + writer.typeKeys("<ctrl y>"); + sleep(1); + writer.typeKeys("<ctrl end>"); + writer.typeKeys("<enter>"); + sleep(2); + +// Word Spell Check + writer.typeKeys("goood"); + sleep(2); + writer.menuItem("Tools->Spelling and Grammar...").select(); + sleep(2); + SuggestionList.select(0); + Change.click(); + sleep(2); + ActiveMsgBox.no(); + sleep(2); + + +// Create Header and Footer + writer.menuItem("Insert->Header->Default").select(); + sleep(2); + writer.typeKeys("Header"); + sleep(2); + writer.menuItem("Insert->Footer->Default").select(); + sleep(2); + writer.typeKeys("Footer"); + sleep(2); + writer.typeKeys("<ctrl end>"); + sleep(2); + writer.typeKeys("<enter>"); + sleep(2); + +// Insert Frame and change anchor + writer.menuItem("Insert->Frame...").select(); + sleep(2); + writer_FrameDlg.ok(); + writer.menuItem("Format->Anchor->To Page").select(); + sleep(2); + writer.menuItem("Format->Anchor->To Paragraph").select(); + sleep(2); + writer.menuItem("Format->Anchor->To Character").select(); + sleep(2); + writer.menuItem("Format->Anchor->As Character").select(); + sleep(2); + writer.typeKeys("<esc>"); + sleep(2); + writer.typeKeys("<enter>"); + sleep(2); + +// Insert TOC + for(int j = 0; j < 6; j++) + { + writer.typeKeys(String.valueOf(j + 1)); + writer.typeKeys("<enter>"); + } + writer.typeKeys("<ctrl home>"); + for(int k = 0; k < 2; k++) + { + writer.typeKeys("<shift down>"); + } + if(!StyleAndFormattingDlg.exists()) + { + app.dispatch(".uno:DesignerDialog"); + sleep(2); + } + + StyleAndFormattingList.doubleClick(0.5, 0.25); + sleep(2); + writer.typeKeys("<down>"); + writer.typeKeys("<right>"); + writer.typeKeys("<left>"); + for(int k = 0; k < 2; k++) + { + writer.typeKeys("<shift down>"); + } + StyleAndFormattingList.doubleClick(0.5, 0.3); + sleep(2); + writer.typeKeys("<ctrl home>"); + sleep(2); + writer.menuItem("Insert->Indexes and Tables->Indexes and Tables...").select(); + sleep(2); + InsertIndexDlg.ok(); + sleep(2); + writer.typeKeys("<ctrl end>"); + + +// Save File and close + String saveTo = "temp" + i + ".odt"; + writer.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + if(ActiveMsgBox.exists()) + { + ActiveMsgBox.yes(); + sleep(2); + } + + writer.menuItem("File->Close").select(); + + HashMap<String, Object> perfData = SystemUtil.getProcessPerfData(pid); + String record = i + "," + System.currentTimeMillis() + "," + perfData.get("rss") + "," + perfData.get("pcpu"); + LOG.info("Record: " + record); + result.println(record); + result.flush(); + + sleep(3); + } + + + } +} Modified: incubator/ooo/trunk/main/test/testgui/source/testlib/gui/UIMap.java URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testlib/gui/UIMap.java?rev=1375948&r1=1375947&r2=1375948&view=diff ============================================================================== --- incubator/ooo/trunk/main/test/testgui/source/testlib/gui/UIMap.java (original) +++ incubator/ooo/trunk/main/test/testgui/source/testlib/gui/UIMap.java Wed Aug 22 08:50:37 2012 @@ -51,7 +51,7 @@ import org.openoffice.test.vcl.widgets.V * */ public class UIMap { - private static IDList idList = new IDList(new File("./idsd")); + private static IDList idList = new IDList(new File("./hid")); public static final VclMessageBox ActiveMsgBox = new VclMessageBox(Constant.UID_ACTIVE); public static final VclMessageBox MsgBox_AdditionalRowsNotSaved = new VclMessageBox(Constant.UID_ACTIVE, "Additional rows were not saved."); public static final VclTabControl ActiveTabControl = new VclTabControl(Constant.UID_ACTIVE); @@ -223,7 +223,8 @@ public class UIMap { public static final VclDialog writer_ConvertTableToTextDlg = dialog(".uno:ConvertTableText"); public static final VclWindow writer_Navigator = window("SW_HID_NAVIGATION_PI"); public static final VclListBox writer_NavigatorList = listbox("SW_HID_NAVIGATOR_TREELIST"); - public static final VclControl writer_FrameDlg = control("SW_HID_FRM_STD"); +// public static final VclControl writer_FrameDlg = control("SW_HID_FRM_STD"); + public static final VclDialog writer_FrameDlg = dialog("SW_HID_FRM_STD"); public static final VclField SC_NumberOfColumnsRowsToInsert = field("1502452023"); public static final VclDialog SC_InsertColumnsRowsdialog = dialog("26166"); public static final VclButton SC_InsertColumnsRowsAfterSelectColumn = button("1502446395"); @@ -356,6 +357,19 @@ public class UIMap { public static final VclButton SC_FunctionWizardDlg_Next = button("formula:PushButton:RID_FORMULADLG_FORMULA:BTN_FORWARD"); public static final VclTreeListBox OptionsDlg_PathTabTree = tree("CUI_HID_OPTPATH_CTL_PATH"); public static final VclTreeListBox OptionsDlg_MicorOfficeTree = tree("CUI_HID_OFAPAGE_MSFLTR2_CLB"); + public static final VclTabPage Bullet = tabpage("CUI_HID_SVXPAGE_PICK_BULLET"); + // Writer: "Spell check" dialog + public static final VclDialog spellcheck = dialog("CUI_HID_SPELLCHECK"); + public static final VclListBox LanguageList = listbox("cui:ListBox:RID_SVXDLG_SPELLCHECK:LB_LANGUAGE"); + public static final VclEditBox MisspelledWords = editbox("cui:MultiLineEdit:RID_SVXDLG_SPELLCHECK:ED_NEWWORD"); + public static final VclListBox SuggestionList = listbox("cui:ListBox:RID_SVXDLG_SPELLCHECK:LB_SUGGESTION"); + public static final VclButton IgnoreOnce = button("CUI_HID_SPLDLG_BUTTON_IGNORE"); + public static final VclButton IgnoreAll = button("CUI_HID_SPLDLG_BUTTON_IGNOREALL"); + public static final VclButton Add = button("cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT"); + public static final VclButton Change = button("CUI_HID_SPLDLG_BUTTON_CHANGE"); + public static final VclButton ChangeAll = button("CUI_HID_SPLDLG_BUTTON_CHANGEALL"); + public static final VclButton AutoCorrect = button("cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_AUTOCORR"); + public static final VclButton Close = button("CUI_HID_SPLDLG_BUTTON_CLOSE"); // Presentation:"Table Property" dialog public static final VclButton impress_WizardDlg_Next = button("sd:PushButton:DLG_ASS:BUT_NEXT"); @@ -398,5 +412,46 @@ public class UIMap { public static final VclToolBox Textbox_Toolbar = toolbox(".HelpId:textbar"); public static final VclButton SD_InsertTextboxButtonOnToolbar = button(".uno:Text"); public static final VclButton SD_FormatArea = button(".uno:FormatArea"); + + //Writer:Style and Formatting List + public static final VclControl StyleAndFormattingList = control("SFX2_HID_TEMPLATE_FMT"); + public static final VclListBox StyleFilterList = listbox("SFX2_HID_TEMPLATE_FILTER"); + public static final VclDockingWin StyleAndFormattingDlg = dockingwin(".uno:DesignerDialog"); + + //Writer:Insert Index and Table Dialog + public static final VclDialog InsertIndexDlg = dialog("SW_HID_TP_TOX_SELECT"); + + //Writer:Split Cell Dialog + public static final VclDialog Writer_SplitCellDlg = dialog("cui:ModalDialog:RID_SVX_SPLITCELLDLG"); + + //Writer:Insert Rows/Columns Dialog + public static final VclDialog Writer_InsertRowsDlg = dialog(".uno:InsertRowDialog"); + public static final VclField Writer_InsertNum = field("cui:NumericField:DLG_INS_ROW_COL:ED_COUNT"); + public static final VclButton Writer_InsertBefore = button("cui:RadioButton:DLG_INS_ROW_COL:CB_POS_BEFORE"); + public static final VclButton Writer_InsertAfter = button("cui:RadioButton:DLG_INS_ROW_COL:CB_POS_AFTER"); + public static final VclDialog Writer_InsertColumnsDlg = dialog(".uno:InsertColumnDialog"); + + //Writer:Alignment TabPage of Paragraph format + public static final VclTabPage AlignmentTabPage = tabpage("CUI_HID_FORMAT_PARAGRAPH_ALIGN"); + public static final VclButton Left = button("cui:RadioButton:RID_SVXPAGE_ALIGN_PARAGRAPH:BTN_LEFTALIGN"); + public static final VclButton Right = button("cui:RadioButton:RID_SVXPAGE_ALIGN_PARAGRAPH:BTN_RIGHTALIGN"); + public static final VclButton Center = button("cui:RadioButton:RID_SVXPAGE_ALIGN_PARAGRAPH:BTN_CENTERALIGN"); + public static final VclButton Justified = button("cui:RadioButton:RID_SVXPAGE_ALIGN_PARAGRAPH:BTN_JUSTIFYALIGN"); + public static final VclListBox Lastline = listbox("cui:ListBox:RID_SVXPAGE_ALIGN_PARAGRAPH:LB_LASTLINE"); + public static final VclButton ExpandSingleWord = button("cui:CheckBox:RID_SVXPAGE_ALIGN_PARAGRAPH:CB_EXPAND"); + public static final VclButton SnapToTextGrid = button("cui:CheckBox:RID_SVXPAGE_ALIGN_PARAGRAPH:CB_SNAP"); + public static final VclListBox VerticalAlignment = listbox("cui:ListBox:RID_SVXPAGE_ALIGN_PARAGRAPH:LB_VERTALIGN"); + + //Writer: Insert Object Dialog + public static final VclDialog InsertObject = dialog(".uno:InsertObject"); + public static final VclButton NewObject = button("cui:RadioButton:MD_INSERT_OLEOBJECT:RB_NEW_OBJECT"); + public static final VclButton ObjectFromFile = button("cui:RadioButton:MD_INSERT_OLEOBJECT:RB_OBJECT_FROMFILE"); + public static final VclListBox ObjectType = listbox("cui:ListBox:MD_INSERT_OLEOBJECT:LB_OBJECTTYPE"); + public static final VclEditBox ObjectFilePath = editbox("cui:Edit:MD_INSERT_OLEOBJECT:ED_FILEPATH"); + public static final VclButton ObjectFileSearch = button("cui:PushButton:MD_INSERT_OLEOBJECT:BTN_FILEPATH"); + public static final VclButton ObjectFileLink = button("cui:CheckBox:MD_INSERT_OLEOBJECT:CB_FILELINK"); + + + }