Component WordProcessor { Component MonitorPane { Widget MonitorPane("javax.swing.JTextPane", "MonitorPane"); Event type(text) { MonitorPane.ENTER_TEXT(text); } Event typeselect(text) { MonitorPane.CLEAR_TEXT(); MonitorPane.TYPE_TEXT_NO_POS(text); MonitorPane.SELECT_TEXT("0", text); } Event clear() { MonitorPane.CLEAR_TEXT(); } } Component OpenFileDialog { Widget FileChooser("javax.swing.JFileChooser", "FileChooser"); Event open() { File.open(); FileChooser.CHOOSE_FILE("1.rtf"); } Event open_cancel() { File.open(); FileChooser.SELECT_FILE("1.rtf"); FileChooser.CANCEL(); } Event openImage() { FileChooser.CHOOSE_FILE("1.gif"); } } Component SaveFileDialog { Widget FileChooser("javax.swing.JFileChooser", "FileChooser"); Event save_cancel() { File.save(); FileChooser.SELECT_FILE("1.rtf", "100"); FileChooser.CANCEL(); } Event save() { File.save(); FileChooser.CHOOSE_FILE("1.rtf"); } } Component Toolbar { Component File { Widget NewFile("javax.swing.JButton", "NewFile"); Widget SaveFile("javax.swing.JButton", "SaveFile"); Widget OpenFile("javax.swing.JButton", "OpenFile"); Event new() { NewFile.PUSH(); } Event save() { SaveFile.PUSH(); } Event open() { OpenFile.PUSH(); } } Event testNewFile() { MonitorPane.type(); File.new(); } Event testSaveAndOpen(text) { MonitorPane.type(text); OpenFileDialog.open_cancel(); MonitorPane.type(text); OpenFileDialog.open(); MonitorPane.type(text); SaveFileDialog.save_cancel(); MonitorPane.type(text); SaveFileDialog.save(); } Event testFileIO() { Toolbar.testSaveAndOpen("abcde"); Toolbar.testSaveAndOpen("This is a word processor"); Toolbar.testSaveAndOpen("A word processor is a computer application used for the production of any sort of printable material."); } Event test() { Toolbar.testNewFile(); Toolbar.testFileIO(); } } Component Font { Widget BoldToggle("javax.swing.JButton", "BoldToggle"); Widget ItalicToggle("javax.swing.JButton", "ItalicToggle"); Widget cbFonts("javax.swing.JComboBox", "cbFonts"); Widget cbSizes("javax.swing.JComboBox", "cbSizes"); Event testFontAll(text) { MonitorPane.typeselect(text); BoldToggle.PUSH(); ItalicToggle.PUSH(); cbFonts.SELECT_ITEM_BY_INDEX("2"); cbSizes.SELECT_ITEM_BY_INDEX("2"); } Event test() { Font.testFontAll("abcde"); Font.testFontAll("This is a word processor"); Font.testFontAll("A word processor is a computer application used for the production of any sort of printable material."); } } Component Menubar { Component EditMenu { Widget EditCopyMenu("javax.swing.JMenuItem", "EditCopyMenu"); Widget EditPasteMenu("javax.swing.JMenuItem", "EditPasteMenu"); Widget EditMenu("javax.swing.JMenu", "EditMenu"); Widget EditCutMenu("javax.swing.JMenuItem", "EditCutMenu"); Widget EditUndoMenu("javax.swing.JMenuItem", "EditUndoMenu"); Widget EditRedoMenu("javax.swing.JMenuItem", "EditRedoMenu"); Event copy() { EditMenu.SHOW_MENU_ITEM("Copy"); EditCopyMenu.PUSH(); } Event cut() { EditMenu.SHOW_MENU_ITEM("Cut"); EditCutMenu.PUSH(); } Event paste() { EditMenu.SHOW_MENU_ITEM("Paste"); EditPasteMenu.PUSH(); } Event undo() { EditMenu.SHOW_MENU_ITEM("Undo Append"); EditUndoMenu.PUSH(); } Event redo() { EditMenu.SHOW_MENU_ITEM("Redo Append"); EditRedoMenu.PUSH(); } } Widget FormatMenu("javax.swing.JMenu", "FormatMenu"); Widget InsertImageMenu("javax.swing.JMenu", "InsertImageMenu"); Widget ForegroundColorMenu("javax.swing.JMenu", "ForegroundColorMenu"); Widget BackgroundColorMenu("javax.swing.JMenu", "BackgroundColorMenu"); Widget FormatFontMenu("javax.swing.JMenuItem", "FormatFontMenu"); Widget FormatParagraphMenu("javax.swing.JMenu", "FormatParagraphMenu"); Widget EditReplaceMenu("javax.swing.JMenuItem", "EditReplaceMenu"); Event openReplaceDialog() { EditMenu.SHOW_MENU_ITEM("Replace"); EditReplaceMenu.PUSH(); } Event openParagraphDialog() { FormatMenu.SHOW_MENU_ITEM("Paragraph"); FormatParagraphMenu.PUSH(); } Event openFontDialog() { FormatMenu.SHOW_MENU_ITEM("Font"); FormatFontMenu.PUSH(); } Event ShowStyleUpdateMenu() { FormatMenu.PUSH_MENU("Format|Style|Update"); } Event ShowStyleReapplyMenu() { FormatMenu.PUSH_MENU("Format|Style|Reapply"); } Event insertImage() { FormatMenu.SHOW_MENU_ITEM("Insert Image"); InsertImageMenu.PUSH(); OpenFileDialog.openImage(); } Event testForeColor(text) { MonitorPane.typeselect(text); FormatMenu.SHOW_MENU_ITEM("Selection Foreground"); ForegroundColorMenu.PUSH(); ForegroundColorMenu.RELEASE_MOUSE("Left", "20", "20"); } Event testBackColor(text) { MonitorPane.typeselect(text); FormatMenu.SHOW_MENU_ITEM("Selection Background"); BackgroundColorMenu.PUSH(); BackgroundColorMenu.RELEASE_MOUSE("Left", "20", "20"); } Event test() { Menubar.testForeColor("abcde"); Menubar.testForeColor("This is a word processor"); Menubar.testForeColor("A word processor is a computer application used for the production of any sort of printable material."); Menubar.testBackColor("abcde"); Menubar.testBackColor("This is a word processor."); Menubar.testBackColor("A word processor is a computer application used for the production of any sort of printable material."); Menubar.insertImage(); } } Component Style { Widget cbStyles("javax.swing.JComboBox", "cbStyles"); Event test() { Style.testStyle("abcde"); Style.testStyleMenu("abcde"); Style.testStyle("This is a word processor"); Style.testStyleMenu("This is a word processor"); Style.testStyle("A word processor is a computer application used for the production of any sort of printable material."); Style.testStyleMenu("A word processor is a computer application used for the production of any sort of printable material."); } Event testStyle(text) { MonitorPane.typeselect(text); cbStyles.SELECT_ITEM_BY_STRING("default"); cbStyles.ENTER_TEXT("mystyle"); cbStyles.SELECT_ITEM_BY_STRING("mystyle"); } Event testStyleMenu(text) { MonitorPane.typeselect(text); Menubar.ShowStyleUpdateMenu(); Menubar.ShowStyleReapplyMenu(); } } Component FontEdit { Event test() { FontEdit.testEdit("abcde"); FontEdit.testEdit("This is a word processor"); FontEdit.testEdit("A word processor is a computer application used for the production of any sort of printable material."); } Event testEdit(text) { MonitorPane.typeselect(text); FontEdit.CopyPaste(); MonitorPane.typeselect(text); FontEdit.CutPaste(); MonitorPane.typeselect(text); FontEdit.UndoRedo(); } Event CopyPaste() { EditMenu.copy(); MonitorPane.clear(); EditMenu.paste(); } Event CutPaste() { EditMenu.cut(); MonitorPane.clear(); EditMenu.paste(); } Event UndoRedo() { EditMenu.undo(); EditMenu.undo(); EditMenu.undo(); EditMenu.redo(); EditMenu.redo(); EditMenu.redo(); } } Component FontDialog { Widget Cancel("javax.swing.JButton", "Cancel"); Widget Ok("javax.swing.JButton", "Ok"); Widget FontBoldCheck("javax.swing.JCheckBox", "FontBoldCheck"); Widget FontItalicCheck("javax.swing.JCheckBox", "FontItalicCheck"); Widget FontUnderlineCheck("javax.swing.JCheckBox", "FontUnderlineCheck"); Widget FontStrikethroughCheck("javax.swing.JCheckBox", "FontStrikethroughCheck"); Widget FontSubscriptCheck("javax.swing.JCheckBox", "FontSubscriptCheck"); Widget FontSuperscriptCheck("javax.swing.JCheckBox", "FontSuperscriptCheck"); Widget ListName:("javax.swing.JList", "ListName:"); Widget FontColor("javax.swing.JComboBox", "FontColor"); Widget ListSize:("javax.swing.JList", "ListSize:"); Event test() { FontDialog.TestCase("abcde"); FontDialog.TestCase("This is a word processor"); FontDialog.TestCase("A word processor is a computer application used for the production of any sort of printable material."); } Event TestCase(text) { FontDialog.setup(text); FontDialog.testCancel(); FontDialog.setup(text); FontDialog.testFontBold(); FontDialog.setup(text); FontDialog.testFontItalic(); FontDialog.setup(text); FontDialog.testFontUnderline(); FontDialog.setup(text); FontDialog.testFontStrike(); FontDialog.setup(text); FontDialog.testFontSubscript(); FontDialog.setup(text); FontDialog.testFontSuperscript(); FontDialog.setup(text); FontDialog.testFontName(); FontDialog.setup(text); FontDialog.testFontColor(); FontDialog.setup(text); FontDialog.testFontSize(); } Event setup(text) { MonitorPane.typeselect(text); Menubar.openFontDialog(); } Event doOk() { Ok.PUSH(); } Event doCancel() { Cancel.PUSH(); } Event testCancel() { FontDialog.doCancel(); } Event testFontBold() { FontBoldCheck.PUSH(); FontDialog.doOk(); } Event testFontItalic() { FontItalicCheck.PUSH(); FontDialog.doOk(); } Event testFontUnderline() { FontUnderlineCheck.PUSH(); FontDialog.doOk(); } Event testFontStrike() { FontStrikethroughCheck.PUSH(); FontDialog.doOk(); } Event testFontSubscript() { FontSubscriptCheck.PUSH(); FontDialog.doOk(); } Event testFontSuperscript() { FontSuperscriptCheck.PUSH(); FontDialog.doOk(); } Event testFontName() { ListName:.CLICK_ON_ITEM_BY_INDEX("1", "1"); FontDialog.doOk(); } Event testFontColor() { FontColor.SELECT_ITEM_BY_INDEX("10"); FontDialog.doOk(); } Event testFontSize() { ListSize:.CLICK_ON_ITEM_BY_INDEX("1", "1"); FontDialog.doOk(); } } Component ParagraphDialog { Component Align { Widget ParagraphCenter("javax.swing.JButton", "ParagraphCenter"); Widget ParagraphRight("javax.swing.JButton", "ParagraphRight"); Widget ParagraphLeft("javax.swing.JButton", "ParagraphLeft"); Widget ParagraphJustified("javax.swing.JButton", "ParagraphJustified"); Event center() { ParagraphCenter.PUSH(); ParagraphDialog.doCancel(); } Event right() { ParagraphRight.PUSH(); ParagraphDialog.doOk(); } Event left() { ParagraphLeft.PUSH(); ParagraphDialog.doOk(); } Event justified() { ParagraphJustified.PUSH(); ParagraphDialog.doOk(); } } Component Space { Widget LineSpacing("javax.swing.JTextField", "LineSpacing"); Widget SpaceAbove("javax.swing.JTextField", "SpaceAbove"); Widget SpaceBelow("javax.swing.JTextField", "SpaceBelow"); Event LineSpace() { LineSpacing.ENTER_TEXT("1.0"); ParagraphDialog.doOk(); } Event LineAbove() { SpaceAbove.ENTER_TEXT("1.0"); ParagraphDialog.doOk(); } Event LineBelow() { SpaceBelow.ENTER_TEXT("1.0"); ParagraphDialog.doOk(); } } Component Indent { Widget FirstIndent("javax.swing.JTextField", "FirstIndent"); Widget LeftIndent("javax.swing.JTextField", "LeftIndent"); Widget RightIndent("javax.swing.JTextField", "RightIndent"); Event first() { FirstIndent.ENTER_TEXT("1.0"); ParagraphDialog.doOk(); } Event left() { LeftIndent.ENTER_TEXT("1.0"); ParagraphDialog.doOk(); } Event right() { RightIndent.ENTER_TEXT("1.0"); ParagraphDialog.doOk(); } } Widget Cancel("javax.swing.JButton", "Cancel"); Widget Ok("javax.swing.JButton", "Ok"); Event doOk() { Ok.PUSH(); } Event doCancel() { Cancel.PUSH(); } Event setup(text) { MonitorPane.typeselect(text); Menubar.openParagraphDialog(); } Event test() { ParagraphDialog.TestCase("abcde"); ParagraphDialog.TestCase("This is a word processor"); ParagraphDialog.TestCase("A word processor is a computer application used for the production of any sort of printable material."); } Event TestCase(text) { ParagraphDialog.setup(text); ParagraphDialog.doCancel(); ParagraphDialog.setup(text); Align.center(); ParagraphDialog.setup(text); Align.right(); ParagraphDialog.setup(text); Align.left(); ParagraphDialog.setup(text); Align.justified(); ParagraphDialog.setup(text); Space.LineSpace(); ParagraphDialog.setup(text); Space.LineAbove(); ParagraphDialog.setup(text); Space.LineBelow(); ParagraphDialog.setup(text); Indent.first(); ParagraphDialog.setup(text); Indent.left(); ParagraphDialog.setup(text); Indent.right(); } } Component FindDialog { Component Find { Widget txtFind1("javax.swing.JTextField", "txtFind1"); Widget btFind("javax.swing.JButton", "btFind"); Event doFind(text) { txtFind1.ENTER_TEXT(text); } Event find() { btFind.PUSH(); } Event testFindEmpty() { Find.doFind("cde"); FindDialog.searchDown(); Find.find(); FindDialog.doConfirm(); FindDialog.doClose(); } Event testFindSearchDown() { Find.doFind("cde"); FindDialog.searchDown(); Find.find(); FindDialog.doConfirm(); FindDialog.doClose(); } Event testSearchUp() { Find.doFind("cde"); FindDialog.searchUp(); Find.find(); FindDialog.doClose(); } Event testSearchUp_2() { Find.doFind("cde"); FindDialog.searchUp(); Find.find(); Find.find(); FindDialog.doConfirm(); FindDialog.doClose(); } Event testSearchUp_chkCase() { Find.doFind("cde"); FindDialog.searchUp(); FindDialog.chkCase(); Find.find(); FindDialog.chkCase(); FindDialog.doClose(); } Event testSearchUp_chkWord() { Find.doFind("cde"); FindDialog.searchUp(); FindDialog.chkWord(); Find.find(); FindDialog.doConfirm(); FindDialog.chkWord(); FindDialog.doClose(); } Event testFind(text) { MonitorPane.clear(); Find.testFindEmpty(); MonitorPane.typeselect(text); Find.testFindSearchDown(); MonitorPane.typeselect(text); Find.testSearchUp(); MonitorPane.typeselect(text); Find.testSearchUp_2(); MonitorPane.typeselect(text); Find.testSearchUp_chkCase(); MonitorPane.typeselect(text); Find.testSearchUp_chkWord(); } } Component Replace { Widget txtFind2("javax.swing.JTextField", "txtFind2"); Widget txtReplace("javax.swing.JTextField", "txtReplace"); Widget btReplace("javax.swing.JButton", "btReplace"); Widget btReplaceAll("javax.swing.JButton", "btReplaceAll"); Widget OptionPane.button("javax.swing.JButton", "OptionPane.button"); Event testReplaceEmpty() { Replace.replace_cde_999(); FindDialog.searchDown(); Replace.doReplace(); FindDialog.doConfirm(); FindDialog.doClose(); } Event testReplaceSearchDown() { Replace.replace_cde_999(); FindDialog.searchDown(); Replace.doReplace(); FindDialog.doConfirm(); FindDialog.doClose(); } Event testReplaceSearchUp() { Replace.replace_cde_999(); FindDialog.searchUp(); Replace.doReplace(); FindDialog.doClose(); } Event testReplaceSearchUp_chkCase() { Replace.replace_cde_999(); FindDialog.searchUp(); FindDialog.chkCase(); Replace.doReplace(); FindDialog.chkCase(); FindDialog.doClose(); } Event testReplaceSearchUp_chkWord() { Replace.replace_cde_999(); FindDialog.searchUp(); FindDialog.chkWord(); Replace.doReplace(); FindDialog.chkWord(); FindDialog.doConfirm(); FindDialog.doClose(); } Event testReplaceAll() { Replace.replace_cde_999(); FindDialog.searchUp(); Replace.doReplaceAll(); Replace.infoConfirm(); FindDialog.doClose(); } Event doReplace() { btReplace.PUSH(); } Event doReplaceAll() { btReplaceAll.PUSH(); } Event replace_cde_999() { txtFind2.ENTER_TEXT("cde"); txtReplace.ENTER_TEXT("999"); } Event infoConfirm() { OptionPane.button.PUSH(); } Event testReplace(text) { MonitorPane.clear(); Replace.testReplaceEmpty(); MonitorPane.typeselect(text); Replace.testReplaceSearchDown(); MonitorPane.typeselect(text); Replace.testReplaceSearchUp(); MonitorPane.typeselect(text); Replace.testReplaceSearchUp_chkCase(); MonitorPane.typeselect(text); Replace.testReplaceSearchUp_chkWord(); MonitorPane.clear(); MonitorPane.type(text); MonitorPane.type(text); MonitorPane.type(text); Replace.testReplaceAll(); } } Widget btClose("javax.swing.JButton", "btClose"); Widget rdDown("javax.swing.JRadioButton", "rdDown"); Widget rdUp("javax.swing.JRadioButton", "rdUp"); Widget OptionPane.button("javax.swing.JButton", "OptionPane.button"); Widget chkCase("javax.swing.JCheckBox", "chkCase"); Widget chkWord("javax.swing.JCheckBox", "chkWord"); Event doClose() { btClose.PUSH(); } Event doConfirm() { OptionPane.button.PUSH(); } Event searchDown() { rdDown.PUSH(); } Event searchUp() { rdUp.PUSH(); } Event chkCase() { chkCase.PUSH(); } Event chkWord() { chkWord.PUSH(); } Event test() { FindDialog.TestCase("abcde"); FindDialog.TestCase("abcdeabcde"); FindDialog.TestCase("abcdeabcdeabcde"); } Event TestCase(text) { Find.testFind(text); Replace.testReplace(text); } } Event DoAllTestCases() { Toolbar.test(); Font.test(); Menubar.test(); Style.test(); FontEdit.test(); FontDialog.test(); ParagraphDialog.test(); } }