View | Details | Raw Unified | Return to issue 120218
Collapse All | Expand All

(-)testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java (-1 / +3 lines)
Lines 100-106 Link Here
100
				if (item == null)
100
				if (item == null)
101
					continue;
101
					continue;
102
				String itemText = path[path.length - 1];
102
				String itemText = path[path.length - 1];
103
				if (item.getTextWithoutMneumonic().contains(itemText)) {
103
//				if (item.getTextWithoutMneumonic().contains(itemText)) {
104
				//Change "contains" into "equals" to avoid the blocking while search for menu item
105
				if (item.getTextWithoutMneumonic().equals(itemText)) {
104
					return item.getId();
106
					return item.getId();
105
				}
107
				}
106
			}
108
			}
(-)testoo/src/testcase/sc/sheet/InsertMultipleSheets.java (+74 lines)
Line 0 Link Here
1
package testcase.sc.sheet;
2
3
import static org.junit.Assert.*;
4
import static org.openoffice.test.vcl.Tester.sleep;
5
import static testlib.AppUtil.initApp;
6
import static testlib.UIMap.*;
7
import static testlib.UIMap.startcenter;
8
9
import org.junit.Before;
10
import org.junit.Rule;
11
import org.junit.Test;
12
13
import testlib.Log;
14
15
/**
16
 * Before running the testing class, you need specify the AOO location firstly with system property openoffice.home.
17
 * 
18
 * @author Shan Zhu
19
 *
20
 */
21
22
public class InsertMultipleSheets {
23
24
	/**
25
	 * TestCapture helps us to do
26
	 * 1. Take a screenshot when failure occurs.
27
	 * 2. Collect extra data when OpenOffice crashes.
28
	 */	
29
	@Rule
30
	public Log LOG = new Log();
31
	
32
	/**
33
	 * initApp helps us to do 
34
	 * 1. Patch the OpenOffice to enable automation if necessary.
35
	 * 2. Start OpenOffice with automation enabled if necessary.
36
	 * 3. Reset OpenOffice to startcenter.
37
	 * 
38
	 * @throws java.lang.Exception
39
	 */
40
	@Before
41
	public void setUp() throws Exception {
42
		initApp();
43
	}
44
	
45
	/**
46
	 * Insert one sheet in different place
47
	 * @throws Exception
48
	 */
49
	@Test
50
	public void testInsertOneSheet(){
51
		//Create a new Spreadsheet
52
		startcenter.menuItem("File->New->Spreadsheet").select();
53
		calc.waitForExistence(10, 3);
54
		sleep(3);
55
		
56
		//Open Insert Sheet dialog via main menu Insert-> Sheet
57
		calc.menuItem("Insert->Sheet...").select();
58
		sleep(2);
59
		//Change new sheet number into 3 to insert 3 new sheet one time
60
		SCSheetNumber.setText("3");
61
		
62
		//Click OK button to create sheet with default setting
63
		SCInsertSheetDlg.ok();
64
		sleep(5);
65
		
66
		//Verify new sheets have been inserted before Sheet1
67
		calc.menuItem("Edit->Sheet->Select...").select();
68
		sleep(2);
69
		assertEquals(6, SCSheetsList.getItemCount());
70
		assertEquals("Sheet4",SCSheetsList.getItemText(0,0));
71
		assertEquals("Sheet6",SCSheetsList.getItemText(2,0));
72
		
73
	}
74
}
(-)testoo/src/testcase/sc/sheet/InsertOneSheet.java (+70 lines)
Line 0 Link Here
1
package testcase.sc.sheet;
2
3
import static org.junit.Assert.*;
4
import static org.openoffice.test.vcl.Tester.sleep;
5
import static testlib.AppUtil.initApp;
6
import static testlib.UIMap.*;
7
import static testlib.UIMap.startcenter;
8
9
import org.junit.Before;
10
import org.junit.Rule;
11
import org.junit.Test;
12
13
import testlib.Log;
14
15
/**
16
 * Before running the testing class, you need specify the AOO location firstly with system property openoffice.home.
17
 * 
18
 * @author Shan Zhu
19
 *
20
 */
21
22
public class InsertOneSheet {
23
24
	/**
25
	 * TestCapture helps us to do
26
	 * 1. Take a screenshot when failure occurs.
27
	 * 2. Collect extra data when OpenOffice crashes.
28
	 */	
29
	@Rule
30
	public Log LOG = new Log();
31
	
32
	/**
33
	 * initApp helps us to do 
34
	 * 1. Patch the OpenOffice to enable automation if necessary.
35
	 * 2. Start OpenOffice with automation enabled if necessary.
36
	 * 3. Reset OpenOffice to startcenter.
37
	 * 
38
	 * @throws java.lang.Exception
39
	 */
40
	@Before
41
	public void setUp() throws Exception {
42
		initApp();
43
	}
44
	
45
	/**
46
	 * Insert one sheet in different place
47
	 * @throws Exception
48
	 */
49
	@Test
50
	public void testInsertOneSheet(){
51
		//Create a new Spreadsheet
52
		startcenter.menuItem("File->New->Spreadsheet").select();
53
		calc.waitForExistence(10, 3);
54
		sleep(3);
55
		
56
		//Open Insert Sheet dialog via main menu Insert-> Sheet
57
		calc.menuItem("Insert->Sheet...").select();
58
		sleep(2);
59
		
60
		//Click OK button to create sheet with default setting
61
		SCInsertSheetDlg.ok();
62
		sleep(5);
63
		
64
		//Verify new sheet has been inserted before Sheet1
65
		calc.menuItem("Edit->Sheet->Select...").select();
66
		sleep(2);
67
		assertEquals("Sheet4",SCSheetsList.getItemText(0,0));
68
		
69
	}
70
}
(-)testoo/src/testlib/UIMap.java (+17 lines)
Lines 335-338 Link Here
335
	public static final VclDialog SortWarningDlg = dialog("sc:ModalDialog:RID_SCDLG_SORT_WARNING");
335
	public static final VclDialog SortWarningDlg = dialog("sc:ModalDialog:RID_SCDLG_SORT_WARNING");
336
	public static final VclButton SortWarningDlg_Extend = button("sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_EXTSORT");
336
	public static final VclButton SortWarningDlg_Extend = button("sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_EXTSORT");
337
	public static final VclButton SortWarningDlg_Current = button("sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_CURSORT");
337
	public static final VclButton SortWarningDlg_Current = button("sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_CURSORT");
338
	// Spreadsheet: "Sheet" dialog
339
	public static final VclDialog SCInsertSheetDlg = dialog("sc:ModalDialog:RID_SCDLG_INSERT_TABLE");
340
	public static final VclButton SCBeforeCurrentSheet = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_BEFORE");
341
	public static final VclButton SCAfterCurrentSheet = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_BEHIND");
342
	public static final VclButton SCNewSheet = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_NEW");
343
	public static final VclButton SCNewSheetFromFile = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_FROMFILE");
344
	public static final VclEditBox SCNewSheetName = editbox("sc:Edit:RID_SCDLG_INSERT_TABLE:ED_TABNAME");
345
	public static final VclField SCSheetNumber = field("sc:NumericField:RID_SCDLG_INSERT_TABLE:NF_COUNT");
346
	public static final VclListBox SCFromFileSheetList = listbox("sc:MultiListBox:RID_SCDLG_INSERT_TABLE:LB_TABLES");
347
	public static final VclButton SCFromFileBrowse = button("sc:PushButton:RID_SCDLG_INSERT_TABLE:BTN_BROWSE");
348
	public static final VclButton SCFromFileLink = button("sc:CheckBox:RID_SCDLG_INSERT_TABLE:CB_LINK");
349
	// Spreadsheet: "Select Sheets" dialog
350
	public static final VclDialog SCSelectSheetsDlg = dialog(".uno:SelectTables");
351
	public static final VclListBox SCSheetsList = listbox("SC_HID_SELECTTABLES");
352
	
353
	
354
	
338
}
355
}

Return to issue 120218