def save(self, filename): """ It tries to save the current opened buffer to the filename passed as parameter. TODO: It does not manage the overwrite dialog yet. @type filename: string @param filename: The name of the file to save the buffer to. """ Application.save(self, self.MNU_SAVE) ooldtp.context(self.name) ldtp.waittillguiexist(self.SAVE_DLG) save_dialog = ooldtp.context(self.SAVE_DLG) save_dlg_txt_filename = save_dialog.getchild(self.SAVE_DLG_TXT_NAME) ldtp.wait(2) save_dlg_txt_filename.settextvalue(filename) save_dlg_btn_save = save_dialog.getchild(self.SAVE_DLG_BTN_SAVE) save_dlg_btn_save.click() ldtp.waittillguinotexist(self.SAVE_DLG) ldtp.wait(1)
def change_font(self, category): appearance = ooldtp.context(self.name) appearance.getchild(self.PTABLE).selecttab(self.PTAB_FONTS) appearance.getchild(self.FONTS[category]["BTN"]).click() ldtp.wait(2) if (ldtp.guiexist(self.DLG_PICKAFONT)): pickaFont = ooldtp.context(self.DLG_PICKAFONT) pickaFont.getchild(self.TBL_FAMILY).selectrow(self.FONTS[category]["FAMILY"]) pickaFont.getchild(self.TBL_STYLE).selectrow(self.FONTS[category]["STYLE"]) pickaFont.getchild(self.TBL_SIZE).selectrow(self.FONTS[category]["SIZE"]) pickaFont.getchild(self.BTN_OK).click() else: raise ldtp.LdtpExecutionError, "Failed to setup font properties" ldtp.waittillguiexist(self.WINDOW) #To check the change has been made as expected font_prop = appearance.getchild(self.FONTS[category]["BTN"]).getobjectproperty('children').split(' ') for i in range(len(font_prop)): if (font_prop[i].__contains__(self.FONTS[category]["FAMILY"]) and \ font_prop[i].__contains__(self.FONTS[category]["STYLE"].replace(' ',''))) or \ (font_prop[i] == ('lbl' + self.FONTS[category]["FAMILY"] + self.FONTS[category]["STYLE"].replace(' ',''))) or \ (font_prop[i] == ('lbl' + self.FONTS[category]["FAMILY"])) or \ (font_prop[i].__contains__(self.FONTS[category]["FAMILY"])) or \ (font_prop[i].__contains__(self.FONTS[category]["SIZE"])): pass else: raise ldtp.LdtpExecutionError, "Font properties not changed correctly"
def revert_font(self): appearance = ooldtp.context(self.name) appearance.getchild(self.PTABLE).selecttab(self.PTAB_FONTS) font_btn = [self.BTN_APPLICATIONFONT, self.BTN_DOCUMENTFONT, self.BTN_DESKTOPFONT, self.BTN_WINDOWTITLEFONT, self.BTN_FIXEDWIDTHFONT] for btn in font_btn: appearance.getchild(btn).click() ldtp.wait() if ldtp.guiexist(self.DLG_PICKAFONT): pickaFont = ooldtp.context(self.DLG_PICKAFONT) if btn == self.BTN_WINDOWTITLEFONT: pickaFont.getchild(self.TBL_FAMILY).selectrow('Sans') pickaFont.getchild(self.TBL_STYLE).selectrow('Bold') elif btn == self.BTN_FIXEDWIDTHFONT: pickaFont.getchild(self.TBL_FAMILY).selectrow('Monospace') pickaFont.getchild(self.TBL_STYLE).selectrow('Regular') else: pickaFont.getchild(self.TBL_FAMILY).selectrow('Sans') pickaFont.getchild(self.TBL_STYLE).selectrow('Regular') pickaFont.getchild(self.TBL_SIZE).selectrow('10') pickaFont.getchild(self.BTN_OK).click() if platform.processor() == 'sparc': ldtp.waittillguiexist(self.WINDOW, 30) else: ldtp.waittillguiexist(self.WINDOW, 10) else: raise ldtp.LdtpExecutionError, "Failed to restore the default font settings"
def open_preferences(self): """ To open the gnome-system-monitor preferences dialog and close it """ monitor = ooldtp.context(self.WINDOW) monitor.getchild(self.MNU_PREFERENCES).selectmenuitem() pref = ooldtp.context(self.DLG_PREFERENCES) pref.getchild(self.BTN_CLOSE).click()
def change_picture_to_default(self): about_me = ooldtp.context(self.WINDOW) #set the photo to no image about_me.getchild(self.BTN_0).click() ldtp.wait(2) selectImage = ooldtp.context(self.DLG_SELECTIMAGE) selectImage.getchild(self.BTN_NOIMAGE).click()
def close(self, save=False, filename=''): """ Given a gedit window, it tries to close the application. By default, it closes without saving. This behaviour can be changed to save (or save as) on close. @type save: boolean @param save: If True, the edited file will be saved on close. @type filename: string @param filename: The file name to save the buffer to """ # Exit using the Quit menu gedit = ooldtp.context(self.name) quit_menu = gedit.getchild(self.MNU_QUIT) quit_menu.selectmenuitem() question_dialog = None count = 0 while not gedit.waittillguinotexist(guiTimeOut=1) and \ count < 10: try: question_dialog = ooldtp.context(self.QUESTION_DLG) except: count += 1 else: break # If the text has changed, the save dialog will appear if question_dialog: # Test if the file needs to be saved if save: try: question_dlg_btn_save = question_dialog.getchild(self.QUESTION_DLG_BTN_SAVE) question_dlg_btn_save.click() except ldtp.LdtpExecutionError: # If the Save button was not found, we will try to find the Save As question_dlg_btn_save = question_dialog.getchild(self.QUESTION_DLG_BTN_SAVE_AS) question_dlg_btn_save.click() ldtp.waittillguiexist(self.SAVE_DLG) save_dialog = ooldtp.context(self.SAVE_DLG) save_dlg_txt_filename = save_dialog.getchild(self.SAVE_DLG_TXT_NAME) ldtp.wait(2) save_dlg_txt_filename.settextvalue(filename) save_dlg_btn_save = save_dialog.getchild(self.SAVE_DLG_BTN_SAVE) save_dlg_btn_save.click() ldtp.waittillguinotexist(self.SAVE_DLG) else: question_dlg_btn_close = question_dialog.getchild(self.QUESTION_DLG_BTN_CLOSE) question_dlg_btn_close.click() gedit.waittillguinotexist(guiTimeOut=20)
def change_appearance(self, tab): appearance = ooldtp.context(self.name) appearance.getchild(self.PTABLE).selecttab(self.PTAB_THEME) appearance.getchild(self.BTN_CUSTOMIZE).click() customizeTheme = ooldtp.context(self.DLG_CUSTOMIZETHEME) customizeTheme.getchild(self.PTABLE).selecttab(self.APPEARANCE_TABS[tab]["TAB"]) self.change_elements(customizeTheme, self.APPEARANCE_TABS[tab]["TABLE"]) customizeTheme.getchild(self.BTN_CLOSE).click() ldtp.waittillguiexist(self.name)
def open_and_check_menu_item(self, menu_item_txt): """ Given a menu item, it tries to open the application associated with it. @type menu_item_txt: string @param menu_item_txt: The name of the menu item that the user wants to open. The naming convention is the following: E{-} Prepend 'mnu' to the menu item E{-} Append the menu item with no spaces. Example: For the menu Disk Usage Analyzer, the menu name would be mnuDiskUsageAnalyzer. """ # topPanel = ooldtp.context(self.__class__.TOP_PANEL) topPanel = ooldtp.context('frmTopExpandedEdgePanel') try: actualMenu = topPanel.getchild(menu_item_txt) except ldtp.LdtpExecutionError: raise ldtp.LdtpExecutionError, "The " + menu_item_txt + " menu was not found. " actualMenu.selectmenuitem() response = ldtp.waittillguiexist(self.name, '', 50) if response == 0: raise ldtp.LdtpExecutionError, "The " + self.name + " window was not found."
def change_view(self, view): """ To verify the processes quantity will change after the process view is changed """ monitor = ooldtp.context(self.WINDOW) monitor.selecttab(self.PTAB, self.PTAB_PROCESSES) """ To get the current checked view menuitem and processes number """ mnu = [self.MNU_ACTIVE, self.MNU_ALL, self.MNU_MY] for i in mnu: if monitor.getchild(i).hasstate('checked'): mnu_before = i tbl_count_bef = monitor.getchild(self.TBL_PROCESSES).getrowcount() if view == 'Active': mnu_select = self.MNU_ACTIVE elif view == 'All' : mnu_select = self.MNU_ALL elif view == 'My': mnu_select = self.MNU_MY #If the selected menu in test case is as same as the application menu which has checked stats, do nothing if mnu_select == mnu_before: pass else: monitor.getchild(mnu_select).selectmenuitem() ldtp.wait(2) tbl_count_aft = monitor.getchild(self.TBL_PROCESSES).getrowcount() if tbl_count_bef == tbl_count_aft: raise ldtp.LdtpExecutionError, "Processes number didn't change, there's something wrong while selecting " + mnu_select + " menu to change processes view."
def verify_sysinfo(self): """ To verify the information listed in System tab """ output = commands.getstatusoutput('uname -a') if output[0] != 0: raise ldtp.LdtpExecutionError, "Get a failure from uname command" result = output[1].split(' ') host = result[1] arc = result[5] release = result[3] OS = result[0] version = result[2] monitor = ooldtp.context(self.WINDOW) monitor.selecttab(self.PTAB,self.PTAB_SYSTEM) if monitor.guiexist(host) == 0: raise ldtp.LdtpExecutionError, "Failed to find host name label" if monitor.guiexist('Kernel'+OS+version) == 0: raise ldtp.LdtpExecutionError, "Failed to find OS and version label" if arc == 'sparc': cpu = 'SPARC' elif arc == 'i386' or arc == 'i86pc': cpu = 'X86' if monitor.guiexist('ReleaseOracleSolaris'+release+cpu) == 0: raise ldtp.LdtpExecutionError, "Failed to find release and cpu label" if monitor.guiexist(self.LBL_SOLARIS) == 0: raise ldtp.LdtpExecutionError, "Failed to find Solaris label" if monitor.guiexist(self.LBL_HARDWARE) == 0: raise ldtp.LdtpExecutionError, "Failed to find Hardware label" if monitor.guiexist(self.LBL_STATUS) == 0: raise ldtp.LdtpExecutionError, "Failed to find System Status label"
def open_file(self,filename): gedit = ooldtp.context(self.name) gedit.selectmenuitem(self.MNU_OPEN) response = ldtp.waittillguiexist(self.OPEN_DLG) if not response: raise "can not open the dialog of open-a-file." openfile_dialog = ooldtp.context(self.OPEN_DLG) if not openfile_dialog.objectexist('txtLocation'): print "Location text exist" openfile_dialog.click('btnOpen') openfile_dialog.settextvalue('txtLocation',filename) openfile_dialog.click('btnOpen') response = ldtp.waittillguinotexist('dlgOpenaFile','',30) if not response: raise "can not open the dialog of open-a-file."
def start_about(self, app_name, about_widget, about_window): """ It will try to open application about window after this application is started. about_widget: application about widget, it might be menu or push button about_window: application about window name """ ldtp.launchapp(app_name) ldtp.waittillguiexist(self.name) mnu = True app = ooldtp.context(self.name) if app.verifypushbutton(about_widget) == 1 and app.hasstate( about_widget, 'enabled') == 1: mnu = False if mnu == True: app.getchild(about_widget).selectmenuitem() else: app.getchild(about_widget).click() ldtp.wait(10) if ldtp.waittillguiexist(about_window) == 0: raise ldtp.LdtpExecutionError, "The " + about_window + " window was not found. "
def change_view(self, view): """ To verify the processes quantity will change after the process view is changed """ monitor = ooldtp.context(self.WINDOW) monitor.selecttab(self.PTAB, self.PTAB_PROCESSES) """ To get the current checked view menuitem and processes number """ mnu = [self.MNU_ACTIVE, self.MNU_ALL, self.MNU_MY] for i in mnu: if monitor.getchild(i).hasstate('checked'): mnu_before = i tbl_count_bef = monitor.getchild(self.TBL_PROCESSES).getrowcount() if view == 'Active': mnu_select = self.MNU_ACTIVE elif view == 'All': mnu_select = self.MNU_ALL elif view == 'My': mnu_select = self.MNU_MY #If the selected menu in test case is as same as the application menu which has checked stats, do nothing if mnu_select == mnu_before: pass else: monitor.getchild(mnu_select).selectmenuitem() ldtp.wait(2) tbl_count_aft = monitor.getchild(self.TBL_PROCESSES).getrowcount() if tbl_count_bef == tbl_count_aft: raise ldtp.LdtpExecutionError, "Processes number didn't change, there's something wrong while selecting " + mnu_select + " menu to change processes view."
def open_file(self, filename): gedit = ooldtp.context(self.name) gedit.selectmenuitem(self.MNU_OPEN) response = ldtp.waittillguiexist(self.OPEN_DLG) if not response: raise "can not open the dialog of open-a-file." openfile_dialog = ooldtp.context(self.OPEN_DLG) if not openfile_dialog.objectexist('txtLocation'): print "Location text exist" openfile_dialog.click('btnOpen') openfile_dialog.settextvalue('txtLocation', filename) openfile_dialog.click('btnOpen') response = ldtp.waittillguinotexist('dlgOpenaFile', '', 30) if not response: raise "can not open the dialog of open-a-file."
def start_help(self, app_name, help_widget, help_window): """ It will try to launch the application, and then open application content help window after application is invoked help_widget: application help widget, which includes menuitem and pushbutton help_window: application help window name """ ldtp.launchapp(app_name) ldtp.waittillguiexist(self.name) app = ooldtp.context(self.name) mnu = True if app.verifypushbutton(help_widget) == 1 and app.hasstate(help_widget, 'enabled') == 1: mnu = False if mnu == True: app.getchild(help_widget).selectmenuitem() else: app.getchild(help_widget).click() if platform.processor() == 'sparc': ldtp.wait(45) else: ldtp.wait(30) if ldtp.guiexist(help_window) == 0: raise ldtp.LdtpExecutionError, "The help window " + help_window + " can't be invoked, something wrong with the application help."
def verify_sysinfo(self): """ To verify the information listed in System tab """ output = commands.getstatusoutput('uname -a') if output[0] != 0: raise ldtp.LdtpExecutionError, "Get a failure from uname command" result = output[1].split(' ') host = result[1] arc = result[5] release = result[3] OS = result[0] version = result[2] monitor = ooldtp.context(self.WINDOW) monitor.selecttab(self.PTAB, self.PTAB_SYSTEM) if monitor.guiexist(host) == 0: raise ldtp.LdtpExecutionError, "Failed to find host name label" if monitor.guiexist('Kernel' + OS + version) == 0: raise ldtp.LdtpExecutionError, "Failed to find OS and version label" if arc == 'sparc': cpu = 'SPARC' elif arc == 'i386' or arc == 'i86pc': cpu = 'X86' if monitor.guiexist('ReleaseOracleSolaris' + release + cpu) == 0: raise ldtp.LdtpExecutionError, "Failed to find release and cpu label" if monitor.guiexist(self.LBL_SOLARIS) == 0: raise ldtp.LdtpExecutionError, "Failed to find Solaris label" if monitor.guiexist(self.LBL_HARDWARE) == 0: raise ldtp.LdtpExecutionError, "Failed to find Hardware label" if monitor.guiexist(self.LBL_STATUS) == 0: raise ldtp.LdtpExecutionError, "Failed to find System Status label"
def revert_default(self): appearance = ooldtp.context(self.name) appearance.getchild(self.PTABLE).selecttab(self.PTAB_BACKGROUND) appearance.getchild(self.BTN_ADD).click() ldtp.waittillguiexist(self.DLG_ADDWALLPAPER) selectWallpaper = ooldtp.context(self.DLG_ADDWALLPAPER) while selectWallpaper.getchild(self.TBTN).press(): if ldtp.hasstate(self.DLG_ADDWALLPAPER,self.TXT_LOCATION,'SHOWING'): selectWallpaper.settextvalue(self.TXT_LOCATION, self.Default) break selectWallpaper.getchild(self.BTN_OPEN).click() ldtp.wait(2) ldtp.waittillguinotexist(self.DLG_ADDWALLPAPER) ldtp.waittillguiexist(self.WINDOW)
def chk_enable_a11y(self): """ To check whether the Enable assistive technologies checkbox checked """ at = ooldtp.context(self.WINDOW) if at.getchild(self.CHK_ENABLEASSISTIVETECHNOLOGIES).verifycheck() != 1: raise ldtp.LdtpExecutionError, "Something wrong with the session! Enable assistive technologies checkbox is not checked!" ldtp.wait(1)
def chk_enable_a11y(self): """ To check whether the Enable assistive technologies checkbox checked """ at = ooldtp.context(self.WINDOW) if at.getchild( self.CHK_ENABLEASSISTIVETECHNOLOGIES).verifycheck() != 1: raise ldtp.LdtpExecutionError, "Something wrong with the session! Enable assistive technologies checkbox is not checked!" ldtp.wait(1)
def check_values(self, new_values): ldtp.waittillguiexist(self.WINDOW) about_me = ooldtp.context(self.WINDOW) for widget, text in new_values.iteritems(): saved_text = about_me.gettextvalue(widget) if not text == saved_text: raise AssertionError('entered text wasn\'t saved correctly, entered: %s saved: %s' % (text, saved_text))
def close_help(self, help_window): """ It tries to close the help window(gnome-help), which is invoked by start_help method. help_window: application help window name """ helpApp = ooldtp.context(help_window) helpApp.getchild('mnuCloseWindow').selectmenuitem() if ldtp.waittillguinotexist(help_window) == 0: raise ldtp.LdtpExecutionError, "The " + help_window + " does not quit as expected, there is something wrong..."
def chk_mouse_a11y(self): """ To check the Mouse Accessibility feature. """ at = ooldtp.context(self.WINDOW) at.getchild(self.BTN_MOUSEACCESSIBILITY).click() if ldtp.waittillguiexist(self.DLG_MOUSE_PREFERENCES) == 1: ldtp.click(self.DLG_MOUSE_PREFERENCES, self.BTN_CLOSE) else: raise ldtp.LdtpExecutionError, "Failed to check Mouse Accessibility feature" ldtp.wait(1)
def chk_keyboard_a11y(self): """ To check the Keyboard Accessibility feature. """ at = ooldtp.context(self.WINDOW) at.getchild(self.BTN_KEYBOARDACCESSIBILITY).click() if ldtp.waittillguiexist(self.DLG_KEYBOARD_PREFERENCES) == 1: ldtp.click(self.DLG_KEYBOARD_PREFERENCES, self.BTN_CLOSE) else: raise ldtp.LdtpExecutionError, "Failed to check Keyboard Accessibility feature" ldtp.wait(1)
def test_search(self): application = ooldtp.context(self.WINDOW) # get search entry search = application.getchild("txtSearch") search.enterstring("ab") time.sleep(2) # check label label = application.getchild("status_text") label_str = label.gettextvalue() # make sure ab always hits the query limit (200 currently) self.assertEqual(label_str, "200 matching items")
def revert_background(self): appearance = ooldtp.context(self.name) appearance.getchild(self.PTABLE).selecttab(self.PTAB_BACKGROUND) appearance.remap() num = len(appearance.getchild(self.LP).getobjectproperty('children').split(' ')) appearance.getchild(self.BTN_REMOVE).click() appearance.remap() num_aft = len(appearance.getchild(self.LP).getobjectproperty('children').split(' ')) if (num - num_aft) != 1: raise ldtp.LdtpExecutionError, "Failed to remove selected background"
def change_picture(self, photo_path): about_me = ooldtp.context(self.WINDOW) about_me.getchild(self.BTN_0).click() ldtp.wait(2) if (ldtp.guiexist(self.DLG_SELECTIMAGE)): selectImage = ooldtp.context(self.DLG_SELECTIMAGE) while selectImage.getchild(self.TBTN).press(): if ldtp.hasstate(self.DLG_SELECTIMAGE,self.TXT_LOCATION,'SHOWING'): break else: raise ldtp.LdtpExecutionError, "Failed to toggle the Location button" selectImage.settextvalue(self.TXT_LOCATION, photo_path) ldtp.wait(2) selectImage.getchild(self.BTN_OPEN).click() ldtp.wait(2) ldtp.waittillguiexist(self.WINDOW)
def notification_preview(self, theme, position): """ This method invokes notification dialog according to preferred theme and position @theme: Standard theme @position: Top Left, Top Right, Bottom Left, Bottom Right """ notif = ooldtp.context(self.WINDOW) mnu_theme = ldtp.getchild(self.WINDOW, theme, 'menu item') mnu_position = ldtp.getchild(self.WINDOW, position, 'menu item') notif.getchild(self.CBO_THEME).comboselect(mnu_theme) notif.getchild(self.CBO_POSITION).comboselect(mnu_position) if notif.getchild(self.CBO_THEME).verifyselect(theme) == 0: raise ldtp.LdtpExecutionError, "Failed to select " + theme + " on Theme combobox." if notif.getchild(self.CBO_POSITION).verifyselect(position) == 0: raise ldtp.LdtpExecutionError, "Failed to select " + position + " on Position combobox." shown = False timer = 1 ldtp.wait(1) while (not shown) and (timer < 3): notif.getchild(self.BTN_PREVIEW).click() ldtp.wait(1) if ldtp.guiexist(self.DLG_NOTIFICATION): shown = True else: ldtp.wait(8) if ldtp.guiexist(self.DLG_ERROR): error = ooldtp.context(self.DLG_ERROR) error.getchild(self.BTN_CLOSE).click() if ldtp.guiexist(self.DLG_ERROR) == 0: ldtp.wait(1) timer = timer + 1 else: raise ldtp.LdtpExecutionError, "Error dialog can't be dismissed, there is something wrong with the application." else: raise ldtp.LdtpExecutionError, "Something wrong with the application, error dialog didn't popup, please check it manually." if (not shown) and timer >= 3: raise ldtp.LdtpExecutionError, "Notification dialog can't be popup, function fails."
def chk_pref_app(self): """ To check the Preferred Application feature """ at = ooldtp.context(self.WINDOW) at.getchild(self.BTN_PREFERREDAPPLICATIONS).click() if ldtp.waittillguiexist(self.DLG_PREFERRED_APPLICATIONS) == 1: ldtp.click(self.DLG_PREFERRED_APPLICATIONS, self.BTN_CLOSE) else: raise ldtp.LdtpExecutionError, "Failed to check Preferred Applications" ldtp.wait(1)
def menu_exists(self, menu=''): app = ooldtp.context(self.WINDOW) if menu == '': menu = "mnu1" try: component = app.getchild(menu) except ldtp.LdtpExecutionError: return False return True
def write_text(self, text, txt_field=''): """ Given an application it tries to write text to its current buffer. """ app = ooldtp.context(self.name) if txt_field == '': ldtp.enterstring(text) else: app_txt_fields = app.getchild(txt_field, "text") for field in app_txt_fields: field.settextvalue(text)
def save(self, save_menu=_('mnuSave')): """ Given an application, it tries to save the current document. This method gives very basic functionality. Please, override this method in the subclasses for error checking. @type save_menu: string @param save_menu: The name of the Save menu of the application. If not mentioned the default will be used ("Save"). """ app = ooldtp.context(self.name) actualMenu = app.getchild(save_menu) actualMenu.selectmenuitem()
def baobab_scan_filesystem(self): baobab = ooldtp.context(self.name) #Scan the filesystem baobab.getchild(self.MNU_SCANFILESYSTEM).selectmenuitem() buttonStop = baobab.getchild(self.BTN_STOP) while buttonStop.stateenabled(): ldtp.wait(2) #Change the views again to see if that works and we don't get any crash. self.baobab_change_views()
def select_tab(self, tab): if tab == 'Contact': tab_name = self.PTAB_CONTACT elif tab == 'Address': tab_name = self.PTAB_ADDRESS elif tab == 'PersonalInfo': tab_name = self.PTAB_PERSONAL else: raise AssertionError("Wrong tab name was given") about_me = ooldtp.context(self.WINDOW) if about_me.getchild(self.PTAB).selecttab(tab_name) != 1 : raise ldtp.LdtpExecutionError, "Failed to select the " + tab + " page tab!"
def change_background(self, background_path): appearance = ooldtp.context(self.name) appearance.getchild(self.PTABLE).selecttab(self.PTAB_BACKGROUND) appearance.remap() num = len(appearance.getchild(self.LP).getobjectproperty('children').split(' ')) appearance.getchild(self.BTN_ADD).click() ldtp.waittillguiexist(self.DLG_ADDWALLPAPER) selectWallpaper = ooldtp.context(self.DLG_ADDWALLPAPER) while selectWallpaper.getchild(self.TBTN).press(): if ldtp.hasstate(self.DLG_ADDWALLPAPER,self.TXT_LOCATION,'SHOWING'): selectWallpaper.settextvalue(self.TXT_LOCATION, background_path) break selectWallpaper.getchild(self.BTN_OPEN).click() ldtp.waittillguinotexist(self.DLG_ADDWALLPAPER) appearance.remap() num_aft = len(appearance.getchild(self.LP).getobjectproperty('children').split(' ')) if (num_aft - num) != 1: raise ldtp.LdtpExecutionError, "Failed to add new background"
def baobab_scan_folder(self, path): baobab = ooldtp.context(self.name) baobab.getchild(self.BTN_SCANFOLDER).click() ldtp.waittillguiexist(self.DLG_SELECTFOLDER) if (ldtp.guiexist(self.DLG_SELECTFOLDER)): selectFiles = ooldtp.context(self.DLG_SELECTFOLDER) if not (selectFiles.getchild(self.TXT_LOCATION)): ldtp.generatekeyevent('<ctrl>l') textLocation = selectFiles.getchild(self.TXT_LOCATION) textLocation.settextvalue(path) ldtp.generatekeyevent('<return>') ldtp.wait(2) buttonStop = baobab.getchild(self.BTN_STOP) while buttonStop.stateenabled(): ldtp.wait() self.baobab_change_views()
def baobab_change_views(self): baobab = ooldtp.context(self.name) #Change the graph view. if baobab.guiexist('cboViewasRingsChart'): baobab.comboselect('cboViewasRingsChart', 'mnuViewasTreemapChart') else: baobab.comboselect('cboViewasTreemapChart', 'mnuViewasRingsChart') #Collapse and expand the tree baobab.getchild(self.MNU_EXPANDALL).selectmenuitem() ldtp.wait(2) baobab.getchild(self.MNU_COLLAPSEALL).selectmenuitem()
def test_search_simple(self): """ perform a basic search test """ context = ooldtp.context(self.window_name) context.enterstring(self.availablePaneSearchEntry, "apt") ldtp.wait(1) row_count = context.getrowcount(self.availablePaneAppView) # ensure we get enough hits self.assertTrue(row_count > 10) # ensure apt is the first hit row = 0 column = 0 text = context.getcellvalue(self.availablePaneAppView, row, column) self.assertEqual(text, "\nInstalled\nAdvanced front-end for dpkg")