예제 #1
0
    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)
예제 #2
0
    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."
예제 #3
0
    def test_startUI(self):
        ldtp.launchapp("./netzob")

        selectWorkspaceFrame = "SelectWorkspace"
        ldtp.waittillguiexist(selectWorkspaceFrame, guiTimeOut=30)
        ldtp.click(selectWorkspaceFrame, "btnCancel")
        ldtp.waittillguinotexist(selectWorkspaceFrame)
예제 #4
0
    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)
예제 #5
0
    def test_startUI(self):
        ldtp.launchapp("./netzob")

        selectWorkspaceFrame = "SelectWorkspace"
        ldtp.waittillguiexist(selectWorkspaceFrame, guiTimeOut=30)
        ldtp.click(selectWorkspaceFrame, "btnCancel")
        ldtp.waittillguinotexist(selectWorkspaceFrame)
예제 #6
0
    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"
예제 #7
0
    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"
예제 #8
0
 def click_type_file_name_button(self):
     if ldtp.guiexist(RHSMGuiLocator().get_locator("import-cert-dialog"), RHSMGuiLocator().get_locator("location-text")) == 1:
         return
     else:
         logger.info("click_type_file_name_button")
         self.click_button("import-cert-dialog", "type-file-name-button")
         ldtp.waittillguiexist(RHSMGuiLocator().get_locator("import-cert-dialog"), RHSMGuiLocator().get_locator("location-text"))
예제 #9
0
        def testInstallSimplePackage(self):
                pkgname = 'package1'
                pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area

                self.pkgsend_bulk(self.rurl, self.foo10)
                self.image_create(self.rurl)

                ldtp.launchapp(pm_str,["-R", self.get_img_path()])
                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)
                ldtp.selectindex('Package Manager', 'Publisher', 0)
                ldtp.selectrow('Package Manager', 'Packages', pkgname)
                ldtp.selectmenuitem('Package Manager', 'mnuEdit;mnuSelect All')
                ldtp.click('Package Manager', 'btnInstall/Update')
                ldtp.waittillguiexist('dlgInstall Confirmation')
                ldtp.click('dlgInstall Confirmation', 'btnProceed')

                while (ldtp.objectexist('dlgInstall/Update', 'btnClose') == 0):
                        ldtp.wait(0.1)

                ldtp.click('dlgInstall/Update', 'btnClose')

                ldtp.waittillguinotexist('dlgInstall/Update')

                # Verify result
                self.pkg('verify')

                # Quit packagemanager
                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
예제 #10
0
    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. "
예제 #11
0
 def setUp(self):
     try:
         ldtp.launchapp('gcalctool')
         ldtp.waittillguiexist('frmCalculator*', guiTimeOut=5)
     except:
         self.tearDown()
         raise
예제 #12
0
파일: gcalctool.py 프로젝트: eeejay/ldtp2
 def setUp(self):
     try:
         ldtp.launchapp('gcalctool')
         ldtp.waittillguiexist('frmCalculator*', guiTimeOut=5)
     except:
         self.tearDown()
         raise
예제 #13
0
    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)
예제 #14
0
 def test_1(self):
     ldtp.waittillguiexist('frmUbuntuSoftwareCent*', 'btnAccessories')
     assert ldtp.objectexist('frmUbuntuSoftwareCent*', 'btnAccessories')
     b = "Time taken from start to find the Accessories button " + str(
         time.time() - start_time) + " Cpu percentage: " + str(
             ldtp.getcpustat(
                 'software-center')) + " Memory usage in MB: " + str(
                     ldtp.getmemorystat('software-center'))
     self.msgs.append(b)
예제 #15
0
 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))
예제 #16
0
파일: t_pm_start.py 프로젝트: aszeszo/test
        def testStartPackagemanager(self):
                pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area

                self.pkgsend_bulk(self.rurl, self.foo10)
                self.image_create(self.rurl)

                ldtp.launchapp(pm_str,["-R", self.get_img_path()])
                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)
                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
예제 #17
0
    def start(self, app, blockingTitle=None, args=None):
        """Starts :app and optionally blocks until window opens
            :blockingTitle title of window to wait for
        """
        if args is None:
            args = []
        launchapp(app, args)

        if blockingTitle:
            waittillguiexist(blockingTitle)
예제 #18
0
def do_screenshot(app, app_name):
    show("Next up is: {} ({})".format(app_name, app))
    l.launchapp(app)
    l.waittillguiexist(app_name)
    if video:
        time.sleep(5)
    l.imagecapture(app_name, os.path.join(basePath, app + ".png"))
    full_screen=l.imagecapture()
    shutil.move(full_screen, os.path.join(basePath, "fullscreen-" + app + ".png"))
    l.generatekeyevent("<alt><f4>")
예제 #19
0
    def testStaticMenu(self, menu_schema, menu_item='', notexists=''):
        self.application.open(menu_schema)
        ldtp.waittillguiexist(self.application.WINDOW)

        if notexists == "True":
            if self.application.menu_exists(menu_item):
                raise AssertionError("The menu item exists")
        else:
            if not self.application.menu_exists(menu_item):
                raise AssertionError("The menu item does not exists")
예제 #20
0
    def testStaticMenu(self, menu_schema, menu_item='', notexists=''):
        self.application.open(menu_schema)
        ldtp.waittillguiexist(self.application.WINDOW)

        if notexists == "True":
            if self.application.menu_exists(menu_item):
                raise AssertionError("The menu item exists")
        else:
            if not self.application.menu_exists(menu_item):
                raise AssertionError("The menu item does not exists")
예제 #21
0
    def open_archive(self, file_path):
        """
        To test open the archive file and extract files to /tmp folder

        @type file_path: char
        @param file_path: the archive file path
        """
        archive = ooldtp.context(self.WINDOW)
        archive.getchild(self.BTN_OPEN).click()
        ldtp.waittillguiexist(self.DLG_OPEN)
        open_dlg = ooldtp.context(self.DLG_OPEN)
        while open_dlg.getchild(self.TBTN_TYPE_A_FILE_NAME).press():
            if ldtp.hasstate(self.DLG_OPEN, self.TXT_LOCATION, 'SHOWING'):
                break
        else:
            raise ldtp.LdtpExecutionError, "Failed to toggle the " + self.DLG_OPEN + " dialog Location button"
        open_dlg.settextvalue(self.TXT_LOCATION,file_path)
        open_dlg.enterstring(self.TXT_LOCATION, '<enter>')
        ldtp.waittillguinotexist(self.DLG_OPEN)

        win_name = 'frm' + self.FILE_NAME + '*'
        ldtp.waittillguiexist(win_name)
        archive = ooldtp.context(win_name)
        archive.getchild(self.BTN_EXTRACT).click()
        ldtp.waittillguiexist(self.DLG_EXTRACT)
        extract = ooldtp.context(self.DLG_EXTRACT)
        while extract.getchild(self.TBTN_TYPE_A_FILE_NAME).press():
            if ldtp.hasstate(self.DLG_EXTRACT, self.TXT_LOCATION, 'SHOWING'):
                break
        else:
            raise ldtp.LdtpExecutionError, "Failed to toggle the " + self.DLG_EXTRACT + " dialog Location button"
        extract.settextvalue(self.TXT_LOCATION,self.EXTRACT_PATH)
        extract.enterstring(self.TXT_LOCATION, '<enter>')
        ldtp.waittillguinotexist(self.DLG_EXTRACT)

        ldtp.waittillguiexist(self.DLG_EXTRACTING_FILES_FROM_ARCHIVE)
        finish = ooldtp.context(self.DLG_EXTRACTING_FILES_FROM_ARCHIVE)
        if finish.getchild(self.LBL_EXTRACTION).hasstate('SHOWING') != 1:
            raise ldtp.LdtpExecutionError, "Failed to extract the archive file"
        finish.getchild(self.BTN_CLOSE).click()
        ldtp.waittillguinotexist(self.DLG_EXTRACTING_FILES_FROM_ARCHIVE)
        """
        Verify the extract action does have outputs
        """
        if archive.getchild(self.MNU_LASTOUTPUT).hasstate('enabled'):
            archive.getchild(self.MNU_LASTOUTPUT).selectmenuitem()
            ldtp.waittillguiexist(self.DLG_LASTOUTPUT) 
            output = ooldtp.context(self.DLG_LASTOUTPUT)
            if output.getchild(self.TXT_0).gettextvalue() == None:
                raise ldtp.LdtpExecutionError, "Last output is none!"
            else:
                output.getchild(self.BTN_CLOSE).click()
        else:
            raise ldtp.LdtpExecutionError, "Nothing output after extraction!"
예제 #22
0
 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)
예제 #23
0
    def open_archive(self, file_path):
        """
        To test open the archive file and extract files to /tmp folder

        @type file_path: char
        @param file_path: the archive file path
        """
        archive = ooldtp.context(self.WINDOW)
        archive.getchild(self.BTN_OPEN).click()
        ldtp.waittillguiexist(self.DLG_OPEN)
        open_dlg = ooldtp.context(self.DLG_OPEN)
        while open_dlg.getchild(self.TBTN_TYPE_A_FILE_NAME).press():
            if ldtp.hasstate(self.DLG_OPEN, self.TXT_LOCATION, 'SHOWING'):
                break
        else:
            raise ldtp.LdtpExecutionError, "Failed to toggle the " + self.DLG_OPEN + " dialog Location button"
        open_dlg.settextvalue(self.TXT_LOCATION, file_path)
        open_dlg.enterstring(self.TXT_LOCATION, '<enter>')
        ldtp.waittillguinotexist(self.DLG_OPEN)

        win_name = 'frm' + self.FILE_NAME + '*'
        ldtp.waittillguiexist(win_name)
        archive = ooldtp.context(win_name)
        archive.getchild(self.BTN_EXTRACT).click()
        ldtp.waittillguiexist(self.DLG_EXTRACT)
        extract = ooldtp.context(self.DLG_EXTRACT)
        while extract.getchild(self.TBTN_TYPE_A_FILE_NAME).press():
            if ldtp.hasstate(self.DLG_EXTRACT, self.TXT_LOCATION, 'SHOWING'):
                break
        else:
            raise ldtp.LdtpExecutionError, "Failed to toggle the " + self.DLG_EXTRACT + " dialog Location button"
        extract.settextvalue(self.TXT_LOCATION, self.EXTRACT_PATH)
        extract.enterstring(self.TXT_LOCATION, '<enter>')
        ldtp.waittillguinotexist(self.DLG_EXTRACT)

        ldtp.waittillguiexist(self.DLG_EXTRACTING_FILES_FROM_ARCHIVE)
        finish = ooldtp.context(self.DLG_EXTRACTING_FILES_FROM_ARCHIVE)
        if finish.getchild(self.LBL_EXTRACTION).hasstate('SHOWING') != 1:
            raise ldtp.LdtpExecutionError, "Failed to extract the archive file"
        finish.getchild(self.BTN_CLOSE).click()
        ldtp.waittillguinotexist(self.DLG_EXTRACTING_FILES_FROM_ARCHIVE)
        """
        Verify the extract action does have outputs
        """
        if archive.getchild(self.MNU_LASTOUTPUT).hasstate('enabled'):
            archive.getchild(self.MNU_LASTOUTPUT).selectmenuitem()
            ldtp.waittillguiexist(self.DLG_LASTOUTPUT)
            output = ooldtp.context(self.DLG_LASTOUTPUT)
            if output.getchild(self.TXT_0).gettextvalue() == None:
                raise ldtp.LdtpExecutionError, "Last output is none!"
            else:
                output.getchild(self.BTN_CLOSE).click()
        else:
            raise ldtp.LdtpExecutionError, "Nothing output after extraction!"
예제 #24
0
파일: common.py 프로젝트: UIKit0/glom
def launch_glom():
	# Start glom:
	ldtp.launchapp('glom')

	# Wait for the initial dialog to appear. The argument matches on the
	# Window title, so make sure to set a window title in Glade or in the
	# code for each window.
	# Wildcard (* and ?) can be used.
	if ldtp.waittillguiexist(main_window) == 0:
		raise ldtp.LdtpExecutionError('The Glom main window did not appear.')
	if ldtp.waittillguiexist(initial_dialog) == 0:
		raise ldtp.LdtpExecutionError('The Glom initial dialog did not appear.')
예제 #25
0
def launch_glom():
    # Start glom:
    ldtp.launchapp('glom')

    # Wait for the initial dialog to appear. The argument matches on the
    # Window title, so make sure to set a window title in Glade or in the
    # code for each window.
    # Wildcard (* and ?) can be used.
    if ldtp.waittillguiexist(main_window) == 0:
        raise ldtp.LdtpExecutionError('The Glom main window did not appear.')
    if ldtp.waittillguiexist(initial_dialog) == 0:
        raise ldtp.LdtpExecutionError(
            'The Glom initial dialog did not appear.')
예제 #26
0
def launch_astylewx_ldtp():
    """Run the test project astylewx program.
    """
    #print("Launching astylewx ldtp")
    if os.name == "nt":
        exepath = (get_astylewx_path()
                   + "/build/"
                   + VS_RELEASE  + "_" + WX_RELEASE
                   + "/debug/AStyleWxd_dll.exe")
        exepath = exepath.replace('/', os.sep)
    else:
        exepath = (get_astylewx_path()
                   + "/build/cb-gcc"
                   + "/wx" + WX_RELEASE
                   + "/bin/astylewxd")
    exeargs = ['--ldtp_test']

    try:
        ldtp.launchapp(exepath, exeargs)
    except ldtp.client_exception.LdtpExecutionError as err:
        print("\nError in launchapp: " + exepath)
        terminate_program(err)

    if not ldtp.waittillguiexist('*AStyleWx'):
        terminate_program("\nError in waittillguiexist")
    ldtp.wait(1)        # needed for linux
 def setUp(self):
     ldtp.launchapp('./software-center')
     assert ldtp.waittillguiexist('frmUbuntuSoftwareCent*')
     self.msgs = []
     a = "Time taken for the frame to open is " + str(
         time.time() - start_time)
     self.msgs.append(a)
예제 #28
0
    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."    
예제 #29
0
def launch_astylewx_ldtp():
    """Run the test project astylewx program.
    """
    #print("Launching astylewx ldtp")
    if os.name == "nt":
        exepath = (get_astylewx_path()
                   + "/build/"
                   + VS_RELEASE  + "_" + WX_RELEASE
                   + "/debug/AStyleWxd_dll.exe")
        exepath = exepath.replace('/', os.sep)
    else:
        exepath = (get_astylewx_path()
                   + "/build/cb-gcc"
                   + "/wx" + WX_RELEASE
                   + "/bin/astylewxd")
    exeargs = ['--ldtp_test']

    try:
        ldtp.launchapp(exepath, exeargs)
    except ldtp.client_exception.LdtpExecutionError as err:
        print("\nError in launchapp: " + exepath)
        terminate_program(err)

    if not ldtp.waittillguiexist('*AStyleWx'):
        terminate_program("\nError in waittillguiexist")
    ldtp.wait(1)        # needed for linux
예제 #30
0
    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 setUp(self):
     ldtp.launchapp('./software-center')
     assert ldtp.waittillguiexist('frmUbuntuSoftwareCent*')
     self.msgs = []
     a = "Time taken for the frame to open is: " + str(
         time.time() - start_time) + " Cpu percentage: " + str(ldtp.getcpustat('software-center')) + " Memory usage in MB: " + str(ldtp.getmemorystat('software-center'))
     self.msgs.append(a)
예제 #32
0
    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)
예제 #33
0
def step_impl(context, popupwin, entry, win):
    click_those = l.getobjectlist(win)
    for thing in click_those:
        l.mouserightclick(win, thing)
        if l.waittillguiexist(popupwin, entry, 1): return
        l.generatekeyevent("<esc>") #close possible menus
        time.sleep(0.5)
    #not found
    assert(False)
예제 #34
0
 def setUp(self):
     ldtp.launchapp('./software-center')
     assert ldtp.waittillguiexist('frmUbuntuSoftwareCent*')
     self.msgs = []
     a = "Time taken for the frame to open is: " + str(
         time.time() - start_time) + " Cpu percentage: " + str(
             ldtp.getcpustat(
                 'software-center')) + " Memory usage in MB: " + str(
                     ldtp.getmemorystat('software-center'))
     self.msgs.append(a)
예제 #35
0
    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)
예제 #36
0
 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)
예제 #37
0
 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)
예제 #38
0
 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)
예제 #39
0
 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)
예제 #40
0
    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)
예제 #41
0
    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)
예제 #42
0
파일: t_pm_rmrepo.py 프로젝트: aszeszo/test
        def testRmRepository(self):
                repo_name = "test2"
                pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area
                ldtp.launchapp(pm_str,["-R", self.get_img_path()])
                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)

                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuManage Publishers...')
                
                ldtp.waittillguiexist('dlgManage Publishers')

                ldtp.selectrow('dlgManage Publishers', 'Publishers', repo_name)

                ldtp.click('dlgManage Publishers', 'btnRemove')

                ldtp.click('dlgManage Publishers', 'btnOK')

                ldtp.waittillguiexist('dlgManage Publishers Confirmation')

                ldtp.click('dlgManage Publishers Confirmation', 'btnOK')

                ldtp.waittillguinotexist('dlgManage Publishers')

                # Verify result
                self.pkg('publisher | grep %s' % repo_name, exit=1)

                # Quit Package Manager
                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
예제 #43
0
파일: baobab.py 프로젝트: zoushidong/mago
    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()
예제 #44
0
파일: baobab.py 프로젝트: zoushidong/mago
    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()
예제 #45
0
파일: main.py 프로젝트: zoushidong/mago
    def open(self):
        """
        Given an application, it tries to open it.
        """
        self._enable_a11y(True)
        ldtp.launchapp(self.LAUNCHER, args=self.LAUNCHER_ARGS)
        self._enable_a11y(False)

        ldtp.wait(2)
        response = ldtp.waittillguiexist(self.name, '', 20)

        if response == 0:
            raise ldtp.LdtpExecutionError, "The " + self.name + " window was not found."
예제 #46
0
    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"
예제 #47
0
파일: main.py 프로젝트: zoushidong/mago
    def open(self):
        """
        Given an application, it tries to open it.
        """
        self._enable_a11y(True)
        ldtp.launchapp(self.LAUNCHER, args=self.LAUNCHER_ARGS)
        self._enable_a11y(False)

        ldtp.wait(2)
        response = ldtp.waittillguiexist(self.name, '', 20)

        if response == 0:
            raise ldtp.LdtpExecutionError, "The " + self.name + " window was not found."
예제 #48
0
def main():
    """Main processing function.
    """
    if os.name == "nt":
        exepath = "C:/Users/jimp/Projects/AStyleWx/build/vs2013_3.0/debug/AStyleWxd.exe"
    else:
        exepath = "../../AStyleWx/build/cb-gcc/wx3.0/bin/astylewxd"
    exepath = exepath.replace('/', os.sep)

    #print(sys.path[0])
    os.chdir(sys.path[0])

    if not os.path.exists(exepath):
        print("Cannot find executable: " + exepath)
        print("The script has terminated!")
        sys.exit(1)

    print("Launching AStyleWx")
    try:
        ldtp.launchapp(exepath)
    except ldtp.client_exception.LdtpExecutionError as err:
        print("Error in launchapp: " + exepath)
        print(err)
        print("The script has terminated!")
        sys.exit(1)
    if not ldtp.waittillguiexist('*AStyleWx'):
        print("Error in waittillguiexist")
        print("The script has terminated!")
        sys.exit(1)

    print('\nFile')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuFile'))
    print('\nEdit')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuEdit'))
    print('\nSearch')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuSearch'))
    print('\nView')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuView'))
    print('\nTools')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuTools'))
    print('\nHelp')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuHelp'))
    print()

    print("Closing AStyleWx")
    ldtp.selectmenuitem('frmAStyleWx', 'mnuFile;mnuExit')
    if not ldtp.waittillguinotexist('*AStyleWx'):
        print("Error in waittillguinotexist")
        print("The script has terminated!")
        sys.exit(1)
예제 #49
0
    def cleanup(self):
        # Exit using the Quit menu
        gedit = ooldtp.context(self.application.name)
        quit_menu = gedit.getchild(self.application.MNU_CLOSE)
        quit_menu.selectmenuitem()

        result = ldtp.waittillguiexist(self.application.QUESTION_DLG,
                                       guiTimeOut=2)

        if result == 1:
            question_dialog = ooldtp.context(self.application.QUESTION_DLG)
            question_dlg_btn_close = question_dialog.getchild(
                self.application.QUESTION_DLG_BTN_CLOSE)
            question_dlg_btn_close.click()

        gedit = ooldtp.context(self.application.name)
        new_menu = gedit.getchild(self.application.MNU_NEW)
        new_menu.selectmenuitem()

        result = ldtp.waittillguiexist(self.application.name,
                                       self.application.TXT_FIELD)
        if result != 1:
            raise ldtp.LdtpExecutionError, "Failed to set up new document."
예제 #50
0
def main():
    """Main processing function.
    """
    if os.name == "nt":
        exepath = "C:/Users/jimp/Projects/AStyleWx/build/vs2013_3.0/debug/AStyleWxd.exe"
    else:
        exepath = "../../AStyleWx/build/cb-gcc/wx3.0/bin/astylewxd"
    exepath = exepath.replace('/', os.sep)

    #print(sys.path[0])
    os.chdir(sys.path[0])

    if not os.path.exists(exepath):
        print("Cannot find executable: " + exepath)
        print("The script has terminated!")
        sys.exit(1)

    print("Launching AStyleWx")
    try:
        ldtp.launchapp(exepath)
    except ldtp.client_exception.LdtpExecutionError as err:
        print("Error in launchapp: " + exepath)
        print(err)
        print("The script has terminated!")
        sys.exit(1)
    if not ldtp.waittillguiexist('*AStyleWx'):
        print("Error in waittillguiexist")
        print("The script has terminated!")
        sys.exit(1)

    print('\nFile')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuFile'))
    print('\nEdit')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuEdit'))
    print('\nSearch')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuSearch'))
    print('\nView')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuView'))
    print('\nTools')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuTools'))
    print('\nHelp')
    print(ldtp.listsubmenus('frmAStyleWx', 'mnuHelp'))
    print()

    print("Closing AStyleWx")
    ldtp.selectmenuitem('frmAStyleWx', 'mnuFile;mnuExit')
    if not ldtp.waittillguinotexist('*AStyleWx'):
        print("Error in waittillguinotexist")
        print("The script has terminated!")
        sys.exit(1)