Index: testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java =================================================================== --- testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java (revision 1357173) +++ testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java (working copy) @@ -100,7 +100,9 @@ if (item == null) continue; String itemText = path[path.length - 1]; - if (item.getTextWithoutMneumonic().contains(itemText)) { +// if (item.getTextWithoutMneumonic().contains(itemText)) { + //Change "contains" into "equals" to avoid the blocking while search for menu item + if (item.getTextWithoutMneumonic().equals(itemText)) { return item.getId(); } } Index: testoo/src/testcase/sc/sheet/InsertMultipleSheets.java =================================================================== --- testoo/src/testcase/sc/sheet/InsertMultipleSheets.java (revision 0) +++ testoo/src/testcase/sc/sheet/InsertMultipleSheets.java (working copy) @@ -0,0 +1,74 @@ +package testcase.sc.sheet; + +import static org.junit.Assert.*; +import static org.openoffice.test.vcl.Tester.sleep; +import static testlib.AppUtil.initApp; +import static testlib.UIMap.*; +import static testlib.UIMap.startcenter; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import testlib.Log; + +/** + * Before running the testing class, you need specify the AOO location firstly with system property openoffice.home. + * + * @author Shan Zhu + * + */ + +public class InsertMultipleSheets { + + /** + * TestCapture helps us to do + * 1. Take a screenshot when failure occurs. + * 2. Collect extra data when OpenOffice crashes. + */ + @Rule + public Log LOG = new Log(); + + /** + * initApp helps us to do + * 1. Patch the OpenOffice to enable automation if necessary. + * 2. Start OpenOffice with automation enabled if necessary. + * 3. Reset OpenOffice to startcenter. + * + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + initApp(); + } + + /** + * Insert one sheet in different place + * @throws Exception + */ + @Test + public void testInsertOneSheet(){ + //Create a new Spreadsheet + startcenter.menuItem("File->New->Spreadsheet").select(); + calc.waitForExistence(10, 3); + sleep(3); + + //Open Insert Sheet dialog via main menu Insert-> Sheet + calc.menuItem("Insert->Sheet...").select(); + sleep(2); + //Change new sheet number into 3 to insert 3 new sheet one time + SCSheetNumber.setText("3"); + + //Click OK button to create sheet with default setting + SCInsertSheetDlg.ok(); + sleep(5); + + //Verify new sheets have been inserted before Sheet1 + calc.menuItem("Edit->Sheet->Select...").select(); + sleep(2); + assertEquals(6, SCSheetsList.getItemCount()); + assertEquals("Sheet4",SCSheetsList.getItemText(0,0)); + assertEquals("Sheet6",SCSheetsList.getItemText(2,0)); + + } +} Index: testoo/src/testcase/sc/sheet/InsertOneSheet.java =================================================================== --- testoo/src/testcase/sc/sheet/InsertOneSheet.java (revision 0) +++ testoo/src/testcase/sc/sheet/InsertOneSheet.java (working copy) @@ -0,0 +1,70 @@ +package testcase.sc.sheet; + +import static org.junit.Assert.*; +import static org.openoffice.test.vcl.Tester.sleep; +import static testlib.AppUtil.initApp; +import static testlib.UIMap.*; +import static testlib.UIMap.startcenter; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import testlib.Log; + +/** + * Before running the testing class, you need specify the AOO location firstly with system property openoffice.home. + * + * @author Shan Zhu + * + */ + +public class InsertOneSheet { + + /** + * TestCapture helps us to do + * 1. Take a screenshot when failure occurs. + * 2. Collect extra data when OpenOffice crashes. + */ + @Rule + public Log LOG = new Log(); + + /** + * initApp helps us to do + * 1. Patch the OpenOffice to enable automation if necessary. + * 2. Start OpenOffice with automation enabled if necessary. + * 3. Reset OpenOffice to startcenter. + * + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + initApp(); + } + + /** + * Insert one sheet in different place + * @throws Exception + */ + @Test + public void testInsertOneSheet(){ + //Create a new Spreadsheet + startcenter.menuItem("File->New->Spreadsheet").select(); + calc.waitForExistence(10, 3); + sleep(3); + + //Open Insert Sheet dialog via main menu Insert-> Sheet + calc.menuItem("Insert->Sheet...").select(); + sleep(2); + + //Click OK button to create sheet with default setting + SCInsertSheetDlg.ok(); + sleep(5); + + //Verify new sheet has been inserted before Sheet1 + calc.menuItem("Edit->Sheet->Select...").select(); + sleep(2); + assertEquals("Sheet4",SCSheetsList.getItemText(0,0)); + + } +} Index: testoo/src/testlib/UIMap.java =================================================================== --- testoo/src/testlib/UIMap.java (revision 1357173) +++ testoo/src/testlib/UIMap.java (working copy) @@ -335,4 +335,21 @@ public static final VclDialog SortWarningDlg = dialog("sc:ModalDialog:RID_SCDLG_SORT_WARNING"); public static final VclButton SortWarningDlg_Extend = button("sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_EXTSORT"); public static final VclButton SortWarningDlg_Current = button("sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_CURSORT"); + // Spreadsheet: "Sheet" dialog + public static final VclDialog SCInsertSheetDlg = dialog("sc:ModalDialog:RID_SCDLG_INSERT_TABLE"); + public static final VclButton SCBeforeCurrentSheet = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_BEFORE"); + public static final VclButton SCAfterCurrentSheet = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_BEHIND"); + public static final VclButton SCNewSheet = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_NEW"); + public static final VclButton SCNewSheetFromFile = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_FROMFILE"); + public static final VclEditBox SCNewSheetName = editbox("sc:Edit:RID_SCDLG_INSERT_TABLE:ED_TABNAME"); + public static final VclField SCSheetNumber = field("sc:NumericField:RID_SCDLG_INSERT_TABLE:NF_COUNT"); + public static final VclListBox SCFromFileSheetList = listbox("sc:MultiListBox:RID_SCDLG_INSERT_TABLE:LB_TABLES"); + public static final VclButton SCFromFileBrowse = button("sc:PushButton:RID_SCDLG_INSERT_TABLE:BTN_BROWSE"); + public static final VclButton SCFromFileLink = button("sc:CheckBox:RID_SCDLG_INSERT_TABLE:CB_LINK"); + // Spreadsheet: "Select Sheets" dialog + public static final VclDialog SCSelectSheetsDlg = dialog(".uno:SelectTables"); + public static final VclListBox SCSheetsList = listbox("SC_HID_SELECTTABLES"); + + + }