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

(-)testcommon/source/org/openoffice/test/vcl/Tester.java (-4 / +2 lines)
Lines 90-99 Link Here
90
	 */
90
	 */
91
	public static void rightClick(int x, int y) {
91
	public static void rightClick(int x, int y) {
92
		robot.mouseMove(x, y);
92
		robot.mouseMove(x, y);
93
		robot.mousePress(InputEvent.BUTTON2_MASK);
93
		robot.mousePress(InputEvent.BUTTON3_MASK);
94
		robot.mouseRelease(InputEvent.BUTTON2_MASK);
94
		robot.mouseRelease(InputEvent.BUTTON3_MASK);
95
		robot.mousePress(InputEvent.BUTTON2_MASK);
96
		robot.mouseRelease(InputEvent.BUTTON2_MASK);
97
		robot.delay(100);
95
		robot.delay(100);
98
	}
96
	}
99
	
97
	
(-)testoo/src/testcase/BVTFunction.java (-2 / +1 lines)
Lines 36-42 Link Here
36
36
37
import org.junit.After;
37
import org.junit.After;
38
import org.junit.Before;
38
import org.junit.Before;
39
import org.junit.Ignore;
40
import org.junit.Rule;
39
import org.junit.Rule;
41
import org.junit.Test;
40
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
41
import org.openoffice.test.common.FileUtil;
Lines 563-569 Link Here
563
	 * 3. Check if the chart is inserted successfully
562
	 * 3. Check if the chart is inserted successfully
564
	 * @throws Exception
563
	 * @throws Exception
565
	 */
564
	 */
566
	@Ignore("There is bug in presentation")
565
	@Test
567
	public void testInsertChartInPresentation() throws Exception{
566
	public void testInsertChartInPresentation() throws Exception{
568
		
567
		
569
		// Create a new presentation document
568
		// Create a new presentation document
(-)testoo/src/testcase/formula/importexport/CreateFormulaInDifferentWays.java (-38 / +55 lines)
Lines 28-77 Link Here
28
28
29
import static testlib.AppUtil.*;
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import static org.junit.Assert.*;
31
import static org.junit.Assert.*;
36
import static org.openoffice.test.vcl.Tester.*;
32
import org.junit.After;
37
38
import org.junit.Before;
33
import org.junit.Before;
39
import org.junit.Ignore;
40
import org.junit.Rule;
34
import org.junit.Rule;
41
import org.junit.Test;
35
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
36
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
37
import testlib.Log;
47
38
48
/**
39
/**
49
 *
40
 *
50
 */
41
 */
51
public class CreateFormulaInDifferentWays {
42
public class CreateFormulaInDifferentWays {
52
	
43
53
	/**
54
	 * TestCapture helps us to do
55
	 * 1. Take a screenshot when failure occurs.
56
	 * 2. Collect extra data when OpenOffice crashes.
57
	 */	
58
	@Rule
44
	@Rule
59
	public Log LOG = new Log();
45
	public Log LOG = new Log();
60
	
46
	
61
	/**
62
	 * initApp helps us to do 
63
	 * 1. Patch the OpenOffice to enable automation if necessary.
64
	 * 2. Start OpenOffice with automation enabled if necessary.
65
	 * 3. Reset OpenOffice to startcenter.
66
	 * 
67
	 * @throws java.lang.Exception
68
	 */
69
	@Before
47
	@Before
70
	public void setUp() throws Exception {
48
	public void setUp() throws Exception {
71
		initApp();
49
		app.start();
72
	}
50
	}
51
52
	@After
53
	public void tearDown() throws Exception {
54
		app.close();
55
	}
73
	
56
	
74
	/**
57
	/**
58
	 * Test elements window active and inactive
59
	 * @throws Exception
60
	 */
61
	@Test
62
	public void testElementsWindowActive() throws Exception{
63
		
64
		// New a formula document
65
		startcenter.menuItem("File->New->Formula").select();
66
		sleep(3);		
67
		
68
		// Check if the "View->Elements" menu is selected
69
		math_EditWindow.menuItem("View").select();
70
		boolean viewElements = math_EditWindow.menuItem("View->Elements").isSelected();
71
		
72
		// If the menu is selected, the Elements window should display
73
		assertEquals("Elements window displays correctly", viewElements, math_ElementsWindow.exists());
74
		
75
		// Active or inactive the Elements window, it should display correctly
76
		math_EditWindow.menuItem("View->Elements").select();
77
		sleep(1);
78
		math_EditWindow.menuItem("View").select();
79
		viewElements = math_EditWindow.menuItem("View->Elements").isSelected();
80
		assertEquals("Elements window display correctly", viewElements, math_ElementsWindow.exists());
81
	}
82
	
83
	/**
75
	 * Test create a formula from Elements window
84
	 * Test create a formula from Elements window
76
	 * @throws Exception
85
	 * @throws Exception
77
	 */
86
	 */
Lines 83-93 Link Here
83
		startcenter.menuItem("File->New->Formula").select();
92
		startcenter.menuItem("File->New->Formula").select();
84
		sleep(3);
93
		sleep(3);
85
94
86
		// Make Elements window pop up (For AOO3.4: View->Elements)
95
		// Make Elements window pop up
87
		math_EditWindow.menuItem("View").select();
96
		math_EditWindow.menuItem("View").select();
88
		if (!math_EditWindow.menuItem("View->Selection").isSelected()) {
97
		if (!math_EditWindow.menuItem("View->Elements").isSelected()) {
89
			math_EditWindow.menuItem("View->Selection").select();			
98
			math_EditWindow.menuItem("View->Elements").select();			
90
		}
99
		}
100
		math_EditWindow.click(1, 1);
91
		
101
		
92
		// Click a formula in Elements window and edit the formula in the commands window
102
		// Click a formula in Elements window and edit the formula in the commands window
93
		math_ElementsRelations.click();
103
		math_ElementsRelations.click();
Lines 100-107 Link Here
100
		String insertedFormula = "a <> b";
110
		String insertedFormula = "a <> b";
101
		
111
		
102
		// Verify if the formula is correct
112
		// Verify if the formula is correct
103
		math_EditWindow.menuItem("Edit->Select All").select();
113
		app.dispatch(".uno:Select");
104
		typeKeys("<$copy>");
114
		app.dispatch(".uno:Copy");
105
		sleep(1);		
115
		sleep(1);		
106
		assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard());	// add " "
116
		assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard());	// add " "
107
		
117
		
Lines 119-127 Link Here
119
		
129
		
120
		// Verify if the formula still exists in the file, and correct
130
		// Verify if the formula still exists in the file, and correct
121
		math_EditWindow.menuItem("Edit->Select All").select();
131
		math_EditWindow.menuItem("Edit->Select All").select();
122
		typeKeys("<$copy>");
132
		app.dispatch(".uno:Copy");
123
		sleep(1);
133
		sleep(1);
124
		assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard());	// add " "
134
		assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard());	// add " "
135
		
136
		// Close all dialogs
137
		app.dispatch(".uno:CloseDoc");
125
	}
138
	}
126
	
139
	
127
	/**
140
	/**
Lines 154-160 Link Here
154
		
167
		
155
		// Verify if the formula is correct
168
		// Verify if the formula is correct
156
		math_EditWindow.menuItem("Edit->Select All").select();
169
		math_EditWindow.menuItem("Edit->Select All").select();
157
		typeKeys("<$copy>");
170
		app.dispatch(".uno:Copy");
158
		sleep(1);		
171
		sleep(1);		
159
		assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard());	// add " "
172
		assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard());	// add " "
160
		
173
		
Lines 172-180 Link Here
172
		
185
		
173
		// Verify if the formula still exists in the file, and correct
186
		// Verify if the formula still exists in the file, and correct
174
		math_EditWindow.menuItem("Edit->Select All").select();
187
		math_EditWindow.menuItem("Edit->Select All").select();
175
		typeKeys("<$copy>");
188
		app.dispatch(".uno:Copy");
176
		sleep(1);
189
		sleep(1);
177
		assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard());	// add " "
190
		assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard());	// add " "
191
				
192
		// Close all dialogs
193
		app.dispatch(".uno:CloseDoc");
178
	}
194
	}
179
	
195
	
180
	/**
196
	/**
Lines 190-215 Link Here
190
206
191
		// Make Elements window pop up (For AOO3.4: View->Elements)
207
		// Make Elements window pop up (For AOO3.4: View->Elements)
192
		math_EditWindow.menuItem("View").select();
208
		math_EditWindow.menuItem("View").select();
193
		if (!math_EditWindow.menuItem("View->Selection").isSelected()) {
209
		if (!math_EditWindow.menuItem("View->Elements").isSelected()) {
194
			math_EditWindow.menuItem("View->Selection").select();			
210
			math_EditWindow.menuItem("View->Elements").select();			
195
		}
211
		}
212
		math_EditWindow.click(1, 1);
196
		
213
		
197
		// Click a formula in Elements window and edit the formula in the commands window
214
		// Click a formula in Elements window and edit the formula in the commands window
198
		math_ElementsUnaryBinary.click();
215
		math_ElementsUnaryBinary.click();
199
		math_ElementsUnaryBinaryPlus.click();
216
		math_ElementsUnaryBinaryPlus.click();
200
		sleep(0.5);
217
		sleep(1);
201
		typeKeys("a");	// "+a";
218
		typeKeys("a");	// "+a";
202
		
219
		
203
		// Undo and verify if it works fine
220
		// Undo and verify if it works fine
204
		math_EditWindow.menuItem("Edit->Undo: Insert").select();
221
		math_EditWindow.menuItem("Edit->Undo: Insert").select();
205
		math_EditWindow.menuItem("Edit->Select All").select();
222
		math_EditWindow.menuItem("Edit->Select All").select();
206
		typeKeys("<$copy>");
223
		app.dispatch(".uno:Copy");
207
		assertEquals("The inserted formula into math", "+<?> ", app.getClipboard());	// add " "	
224
		assertEquals("The inserted formula into math", "+<?> ", app.getClipboard());	// add " "	
208
		
225
		
209
		// Redo and verify if it works fine
226
		// Redo and verify if it works fine
210
		math_EditWindow.menuItem("Edit->Redo: Insert").select();
227
		math_EditWindow.menuItem("Edit->Redo: Insert").select();
211
		math_EditWindow.menuItem("Edit->Select All").select();
228
		math_EditWindow.menuItem("Edit->Select All").select();
212
		typeKeys("<$copy>");
229
		app.dispatch(".uno:Copy");
213
		assertEquals("The inserted formula into math", "+a ", app.getClipboard());	// add " "		
230
		assertEquals("The inserted formula into math", "+a ", app.getClipboard());	// add " "		
214
	}
231
	}
215
}
232
}

Return to issue 120272