Author: wanglf
Date: Tue Nov 13 07:40:24 2012
New Revision: 1408626
URL: http://svn.apache.org/viewvc?rev=1408626&view=rev
Log:
reconstruct GUI FVT case about formula
Added:
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/CharacterFromCatalogDlg.java
- copied, changed from r1408174,
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/InputCharacterFromCatalogDlg.java
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/SymbolsFromCatalog.java
- copied, changed from r1408174,
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/FormulaInDifferentWays.java
- copied, changed from r1408174,
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/CreateFormulaInDifferentWays.java
Removed:
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/InputCharacterFromCatalogDlg.java
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/elements/
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/CreateFormulaInDifferentWays.java
Copied:
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/CharacterFromCatalogDlg.java
(from r1408174,
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/InputCharacterFromCatalogDlg.java)
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/CharacterFromCatalogDlg.java?p2=incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/CharacterFromCatalogDlg.java&p1=incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/InputCharacterFromCatalogDlg.java&r1=1408174&r2=1408626&rev=1408626&view=diff
==============================================================================
---
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/InputCharacterFromCatalogDlg.java
(original)
+++
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/CharacterFromCatalogDlg.java
Tue Nov 13 07:40:24 2012
@@ -29,33 +29,24 @@ import static testlib.gui.UIMap.*;
import org.junit.After;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.openoffice.test.common.Logger;
-/**
- *
- */
-public class InputCharacterFromCatalogDlg {
+import testlib.gui.AppTool;
- @Rule
- public Logger log = Logger.getLogger(this);
+public class CharacterFromCatalogDlg {
@Before
public void setUp() throws Exception {
app.start(true);
-
- // New a formula document
- app.dispatch("private:factory/smath");
- mathEditWindow.waitForExistence(10, 2);
-
+ AppTool.newFormula();
// Click catalog button
mathCatalogButton.click();
}
@After
public void tearDown() throws Exception {
-
+ AppTool.close();
+ app.stop();
}
/**
@@ -80,19 +71,10 @@ public class InputCharacterFromCatalogDl
mathEditWindow.click(5, 5);
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("Symbol is not inserted succcessfully",
"%".concat(selectedSymbol).concat(" "), app.getClipboard()); // add
-
// "%"
-
// in
-
// the
-
// front,
-
// add
-
// " "
-
// in
-
// the
-
// end
+ assertEquals("Symbol is not inserted succcessfully",
+ "%".concat(selectedSymbol).concat(" "),
app.getClipboard());
+ // add "%" in the font, add " " in the end
- // Close all dialogs
- app.dispatch(".uno:CloseDoc");
}
/**
@@ -117,19 +99,9 @@ public class InputCharacterFromCatalogDl
mathEditWindow.click(5, 5);
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("Symbol is not inserted succcessfully",
"%".concat(selectedSymbol).concat(" "), app.getClipboard()); // add
-
// "%"
-
// in
-
// the
-
// front,
-
// add
-
// " "
-
// in
-
// the
-
// end
-
- // Close all dialogs
- app.dispatch(".uno:CloseDoc");
+ assertEquals("Symbol is not inserted succcessfully",
+ "%".concat(selectedSymbol).concat(" "),
app.getClipboard());
+ // add "%" in the font, add " " in the end
}
/**
@@ -154,18 +126,8 @@ public class InputCharacterFromCatalogDl
mathEditWindow.click(5, 5);
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("Symbol is not inserted succcessfully",
"%".concat(selectedSymbol).concat(" "), app.getClipboard()); // add
-
// "%"
-
// in
-
// the
-
// front,
-
// add
-
// " "
-
// in
-
// the
-
// end
-
- // Close all dialogs
- app.dispatch(".uno:CloseDoc");
+ assertEquals("Symbol is not inserted succcessfully",
+ "%".concat(selectedSymbol).concat(" "),
app.getClipboard());
+ // add "%" in the font, add " " in the end
}
}
Copied:
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/SymbolsFromCatalog.java
(from r1408174,
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java)
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/SymbolsFromCatalog.java?p2=incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/SymbolsFromCatalog.java&p1=incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java&r1=1408174&r2=1408626&rev=1408626&view=diff
==============================================================================
---
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java
(original)
+++
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/catalog/SymbolsFromCatalog.java
Tue Nov 13 07:40:24 2012
@@ -29,29 +29,20 @@ import static testlib.gui.UIMap.*;
import org.junit.After;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.openoffice.test.common.Logger;
+import org.openoffice.test.vcl.widgets.VclDialog;
-/**
- *
- */
-public class AddDeleteSymbolsFromCatalog {
+import testlib.gui.AppTool;
- @Rule
- public Logger log = Logger.getLogger(this);
+
+public class SymbolsFromCatalog {
@Before
public void setUp() throws Exception {
app.start(true);
-
- // New a formula document
- app.dispatch("private:factory/smath");
- mathEditWindow.waitForExistence(10, 2);
-
+ AppTool.newFormula();
// Click catalog button
mathCatalogButton.click();
-
// Select "Special", click "Edit" button
mathSymbolsDlgListbox.select(2);
mathSymbolsDlgEditButton.click();
@@ -59,7 +50,8 @@ public class AddDeleteSymbolsFromCatalog
@After
public void tearDown() throws Exception {
-
+ AppTool.close();
+ app.stop();
}
/**
@@ -76,21 +68,16 @@ public class AddDeleteSymbolsFromCatalog
int nListCount;
int nIndex = 1;
do {
- mathEditSymbolsDlgViewControl.click(100 * nIndex, 10);
// risk:
-
// after 6
-
// or 7
-
// circles,
-
// this will
-
// click out
-
// of
-
// ViewControl
+ mathEditSymbolsDlgViewControl.click(100 * nIndex, 10);
+ // risk:after 6 or 7 circles, this will click out of
ViewControl
selectedSymbol = mathEditSymbolsDlgSymbol.getText();
nIndex++;
// Find if the selected symbol is already in the list
bSelectSymbolNotInList = false;
nListCount = mathEditSymbolsDlgSymbol.getItemCount();
for (int i = 0; i < nListCount; i++) {
- if
(selectedSymbol.equals(mathEditSymbolsDlgSymbol.getItemText(i))) {
+ if
(selectedSymbol.equals(mathEditSymbolsDlgSymbol
+ .getItemText(i))) {
bSelectSymbolNotInList = true;
break;
}
@@ -110,11 +97,6 @@ public class AddDeleteSymbolsFromCatalog
}
}
assertTrue("Symbol is not added to Symbol set",
bSelectSymbolNotInList);
-
- // Close all dialogs
- mathEditSymbolsDlg.cancel();
- mathSymbolsDlg.close();
- app.dispatch(".uno:CloseDoc");
}
/**
@@ -126,13 +108,11 @@ public class AddDeleteSymbolsFromCatalog
public void testModifySymbolFontFromCatalog() throws Exception {
// Modify the font of selected symbol
- // String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
int oldSymbolFontIndex = mathEditSymbolsDlgFont.getSelIndex();
- int modifiedSymbolFondIndex = (oldSymbolFontIndex + 1 ==
mathEditSymbolsDlgFont.getItemCount()) ? 0 : (oldSymbolFontIndex + 1);
- mathEditSymbolsDlgFont.select(modifiedSymbolFondIndex); //
select the
-
// next font
-
// of old
-
// font
+ int modifiedSymbolFondIndex = (oldSymbolFontIndex + 1 ==
mathEditSymbolsDlgFont
+ .getItemCount()) ? 0 : (oldSymbolFontIndex + 1);
+ mathEditSymbolsDlgFont.select(modifiedSymbolFondIndex);
+ // select the next font of old font
String modifiedSymbolFont = mathEditSymbolsDlgFont.getSelText();
String selectedSymbol = mathEditSymbolsDlgSymbol.getText();
mathEditSymbolsDlgModify.click();
@@ -141,12 +121,8 @@ public class AddDeleteSymbolsFromCatalog
// Verify if the font of symbol is modified successfully
mathSymbolsDlgEditButton.click();
mathEditSymbolsDlgSymbol.select(selectedSymbol);
- assertEquals("Font of symbol is not modified successfully",
modifiedSymbolFont, mathEditSymbolsDlgFont.getSelText());
-
- // Close all dialogs
- mathEditSymbolsDlg.cancel();
- mathSymbolsDlg.close();
- app.dispatch(".uno:CloseDoc");
+ assertEquals("Font of symbol is not modified successfully",
+ modifiedSymbolFont,
mathEditSymbolsDlgFont.getSelText());
}
/**
@@ -158,16 +134,11 @@ public class AddDeleteSymbolsFromCatalog
public void testModifySymbolTypefaceFromCatalog() throws Exception {
// Modify the typeface of selected symbol
- // String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
int oldSymbolTypefaceIndex =
mathEditSymbolsDlgTypeface.getSelIndex();
- int modifiedSymbolTypefaceIndex = (oldSymbolTypefaceIndex + 1
== mathEditSymbolsDlgTypeface.getItemCount()) ? 0 : (oldSymbolTypefaceIndex +
1);
- mathEditSymbolsDlgTypeface.select(modifiedSymbolTypefaceIndex);
// select
-
// the
-
// next
-
//
typeface
-
// of
-
// old
-
//
typeface
+ int modifiedSymbolTypefaceIndex = (oldSymbolTypefaceIndex + 1
== mathEditSymbolsDlgTypeface
+ .getItemCount()) ? 0 : (oldSymbolTypefaceIndex
+ 1);
+ mathEditSymbolsDlgTypeface.select(modifiedSymbolTypefaceIndex);
+ // select the next typeface of old typeface
String modifiedSymbolTypeface =
mathEditSymbolsDlgTypeface.getSelText();
String selectedSymbol = mathEditSymbolsDlgSymbol.getText();
mathEditSymbolsDlgModify.click();
@@ -176,12 +147,8 @@ public class AddDeleteSymbolsFromCatalog
// Verify if the typeface of symbol is modified successfully
mathSymbolsDlgEditButton.click();
mathEditSymbolsDlgSymbol.select(selectedSymbol);
- assertEquals("Typeface of symbol is not modified successfully",
modifiedSymbolTypeface, mathEditSymbolsDlgTypeface.getSelText());
-
- // Close all dialogs
- mathEditSymbolsDlg.cancel();
- mathSymbolsDlg.close();
- app.dispatch(".uno:CloseDoc");
+ assertEquals("Typeface of symbol is not modified successfully",
+ modifiedSymbolTypeface,
mathEditSymbolsDlgTypeface.getSelText());
}
/**
@@ -196,7 +163,6 @@ public class AddDeleteSymbolsFromCatalog
String selectedSymbol = mathEditSymbolsDlgSymbol.getText();
mathEditSymbolsDlgDelete.click();
mathEditSymbolsDlg.ok();
-
// Verify if the selected symbol is deleted successfully
mathSymbolsDlgEditButton.click();
boolean isDeleted = true;
@@ -207,10 +173,6 @@ public class AddDeleteSymbolsFromCatalog
}
}
assertTrue("Symbol is not deleted successfully", isDeleted);
-
- // Close all dialogs
- mathEditSymbolsDlg.cancel();
- mathSymbolsDlg.close();
- app.dispatch(".uno:CloseDoc");
}
+
}
Copied:
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/FormulaInDifferentWays.java
(from r1408174,
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/CreateFormulaInDifferentWays.java)
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/FormulaInDifferentWays.java?p2=incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/FormulaInDifferentWays.java&p1=incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/CreateFormulaInDifferentWays.java&r1=1408174&r2=1408626&rev=1408626&view=diff
==============================================================================
---
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/CreateFormulaInDifferentWays.java
(original)
+++
incubator/ooo/trunk/test/testgui/source/fvt/gui/formula/importexport/FormulaInDifferentWays.java
Tue Nov 13 07:40:24 2012
@@ -33,29 +33,23 @@ import static testlib.gui.UIMap.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import org.openoffice.test.common.FileUtil;
-import org.openoffice.test.common.Logger;
-/**
- *
- */
-public class CreateFormulaInDifferentWays {
+import testlib.gui.AppTool;
- @Rule
- public Logger log = Logger.getLogger(this);
+
+public class FormulaInDifferentWays {
@Before
public void setUp() throws Exception {
app.start(true);
-
- // New a formula document
- app.dispatch("private:factory/smath");
+ newFormula();
}
@After
public void tearDown() throws Exception {
+ close();
app.stop();
}
@@ -66,13 +60,10 @@ public class CreateFormulaInDifferentWay
*/
@Test
public void testElementsWindowActive() throws Exception {
-
// Check if the "View->Elements" menu is selected
boolean viewElements = mathElementsWindow.exists();
-
// Active or inactive the Elements window
app.dispatch(".uno:ToolBox");
-
assertNotSame("Elements window active/inactive failed",
viewElements, mathElementsWindow.exists());
}
@@ -89,7 +80,6 @@ public class CreateFormulaInDifferentWay
if (!mathElementsWindow.exists()) {
app.dispatch(".uno:ToolBox");
}
-
// Click a formula in Elements window and edit the formula in
the
// commands window
mathElementsRelations.click();
@@ -102,34 +92,20 @@ public class CreateFormulaInDifferentWay
// Verify if the formula is correct
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math",
insertedFormula.concat(" "), app.getClipboard()); // add
-
// " "
-
- // Save the formula
- app.dispatch(".uno:SaveAs");
+ assertEquals("The inserted formula into math",
insertedFormula.concat(" "), app.getClipboard());
+
+ // Save and reopen the formula
FileUtil.deleteFile(saveTo);
- submitSaveDlg(saveTo);
-
- // Close and reopen it
- if (activeMsgBox.exists()) {
- activeMsgBox.yes();
- sleep(2);
- }
- sleep(5);
- app.dispatch(".uno:CloseDoc");
- openStartcenter();
- app.dispatch(".uno:Open");
- submitOpenDlg(saveTo);
+ saveAs(saveTo);
+ close();
+ open(saveTo);
mathEditWindow.waitForExistence(10, 2);
// Verify if the formula still exists in the file, and correct
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math",
insertedFormula.concat(" "), app.getClipboard()); // add
-
// " "
-
- // Close all dialogs
- app.dispatch(".uno:CloseDoc");
+ assertEquals("The inserted formula into math",
insertedFormula.concat(" "), app.getClipboard());
+
}
/**
@@ -142,7 +118,6 @@ public class CreateFormulaInDifferentWay
String saveTo = getPath("temp/" +
"FormulaFromRightClickMenu.odf");
// Right click in equation editor, choose
"Functions->More->arcsin(x)",
- // input a
mathEditWindow.rightClick(5, 5);
typeKeys("<down>");
typeKeys("<down>");
@@ -153,41 +128,25 @@ public class CreateFormulaInDifferentWay
typeKeys("<enter>");
typeKeys("<enter>");
typeKeys("a");
- sleep(2); // If no sleep, error occur on mac
+ sleep(2);
String insertedFormula = "arcsin(a)";
// Verify if the formula is correct
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math",
insertedFormula.concat(" "), app.getClipboard()); // add
-
// " "
-
- // Save the formula
- app.dispatch(".uno:SaveAs");
+ assertEquals("The inserted formula into math",
insertedFormula.concat(" "), app.getClipboard());
+ // Save and reopen the formula
FileUtil.deleteFile(saveTo);
- submitSaveDlg(saveTo);
-
- // Close and reopen it
- if (activeMsgBox.exists()) {
- activeMsgBox.yes();
- sleep(2);
- }
- sleep(5);
- app.dispatch(".uno:CloseDoc");
- openStartcenter();
- app.dispatch(".uno:Open");
- submitOpenDlg(saveTo);
+ saveAs(saveTo);
+ close();
+ open(saveTo);
+
mathEditWindow.waitForExistence(10, 2);
-
// Verify if the formula still exists in the file, and correct
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math",
insertedFormula.concat(" "), app.getClipboard()); // add
-
// " "
-
- // Close all dialogs
- app.dispatch(".uno:CloseDoc");
+ assertEquals("The inserted formula into math",
insertedFormula.concat(" "), app.getClipboard());
}
/**
@@ -196,7 +155,6 @@ public class CreateFormulaInDifferentWay
* @throws Exception
*/
@Test
- @Ignore("Bug #119077 - defect in windows only")
public void testUndoRedoInMath() throws Exception {
// Make Elements window pop up
@@ -214,14 +172,12 @@ public class CreateFormulaInDifferentWay
app.dispatch(".uno:Undo");
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math", "+<?> ",
app.getClipboard()); // add
-
// " "
+ assertEquals("The inserted formula into math", "+<?> ",
app.getClipboard());
// Redo and verify if it works fine
app.dispatch(".uno:Redo");
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math", "+a ",
app.getClipboard()); // add
-
// " "
+ assertEquals("The inserted formula into math", "+a ",
app.getClipboard());
}
}