def test_Something_in_unimacro(self):
     testWindowContents = self.doTestWindowContents
     actions.doKeystroke("testing")
     expected = "testing"
     testWindowContents(expected, "Something testing in ClipboardTest went wrong")
     # tearDown when DragonPad is already closed:
     actions.doAction("KW")
Beispiel #2
0
 def test_Something_in_unimacro(self):
     self.log('testing something')
     actions.doAction("W")
     lang = natqh.getLanguage()
     self.assert_equal(
         "enx", lang,
         "testing should be done from an English speech profile, not: %s" %
         lang)
 def test_Copy_and_paste_clipboard(self):
     testWindowContents = self.doTestWindowContents
     # This test handles several copy and paste meta actions.
     actions.doKeystroke("testing")
     actions.doAction("<<selectall>><<copy>>{ctrl+end}")
     actions.doAction("<<paste>>")
     # Note in DragonPad it apparently endswith "\r\n"...
     expected = "testingtesting\n"  # natqh getClipboard removes '\r', which was in natlink.getClipboard
     testWindowContents(expected, "Something copying and pasting went wrong")
    def test_NON_complete_CLIP_action(self):
        testWindowContents = self.doTestWindowContents
        testActionResult = self.doTestActionResult
##         This test saves the clipboard,breaks off so does not return the ending
        actions.doKeystroke("testing")
        actions.doAction("<<selectall>><<copy>>{ctrl+end}")
        actions.doAction('CLIPSAVE; <<copy>>{ctrl+end}; CLIPISNOTEMPTY; {ctrl+end}abcd<<paste>>defg; CLIPRESTORE; <<paste>>')
        testWindowContents("testing")
        t = natqh.getClipboard()
        # ??? x after testing in test procedure artefact::
        self.assert_equal("testing", t, "Clipboard should filled again now" ) 
    def test_complete_CLIP_action(self):
        testWindowContents = self.doTestWindowContents
        testActionResult = self.doTestActionResult
##         This test saves the clipboard, copies two letters
##         so the test CLIPISNOTEMPTY returns true
##         and the clipboard should be restored next
##         do not forget CLIPRESTORE!   
        actions.doKeystroke("testing")
        actions.doAction("<<selectall>><<copy>>{ctrl+end}")
        actions.doAction('CLIPSAVE; {shift+left 4}<<copy>>{ctrl+end}; CLIPISNOTEMPTY; {ctrl+end}abcd<<paste>>defg; CLIPRESTORE; <<paste>>')
        testWindowContents("testingabcdtingdefgtesting")
Beispiel #6
0
def call_Unimacro(argumentString):
    if unimacro_available:
        #print '[' + argumentString + ']'
        try:
            actions.doAction(argumentString)
        except Exception, e:
            m = "when Vocola called Unimacro to execute:\n" \
                + '        Unimacro(' + argumentString + ')\n' \
                + '    Unimacro reported the following error:\n' \
                + '        ' + type(e).__name__ + ": " + str(e)
            raise VocolaRuntimeError(m)
Beispiel #7
0
def call_Unimacro(argumentString):
    if unimacro_available:
        #print '[' + argumentString + ']'
        try:
            actions.doAction(argumentString)
        except Exception, e:
            m = "when Vocola called Unimacro to execute:\n" \
                + '        Unimacro(' + argumentString + ')\n' \
                + '    Unimacro reported the following error:\n' \
                + '        ' + type(e).__name__ + ": " + str(e)
            raise VocolaRuntimeError, m
Beispiel #8
0
def parseJsonObj(obj):
    try:
        if not ("action" in obj):
            raise BadFieldException("badJson")
        else:
            ans = actions.doAction(obj)
    except BadFieldException, e:
        return {"result": e.value}
Beispiel #9
0
def parseJsonObj(obj):
	try:
		if not('action' in obj):
			raise BadFieldException('badJson')
		else:
			ans = actions.doAction(obj)
	except BadFieldException, e:
		return {'result': e.value}
Beispiel #10
0
def parseJsonObj(obj):
    try:
        if not ('action' in obj):
            raise BadFieldException('badJson')
        else:
            ans = actions.doAction(obj)
    except BadFieldException, e:
        return {'result': e.value}
 def doTestActionResult(self, expected, commandString):
     result = actions.doAction(commandString)
     if expected and result:
         pass
     elif not expected and not result:
         pass
     else:
         self.assert_equal(expected, result,
                           "result of action not as expected")
Beispiel #12
0
def call_Unimacro(argumentString):
    if unimacro_available:
        #print '[' + argumentString + ']'
        try:
            actions.doAction(argumentString)
        except Exception as e:
            # traceback.print_exc()
            m = "when Vocola called Unimacro to execute:\n" \
                + '        Unimacro(' + argumentString + ')\n' \
                + '    Unimacro reported the following error:\n' \
                + '        ' + type(e).__name__ + ": " + str(e)

            raise VocolaRuntimeError(m)
    else:
        m = '\n'.join([
            'Unimacro call failed because ',
            '    the link with Unimacro is unavailable.',
            '    You can fix this by switching on the option:',
            '    "Vocola takes Unimacro Actions" in the',
            '    program "Configure Natlink via GUI".'
        ])
        raise VocolaRuntimeError(m)
    def test_Non_Empty_clipboard_and_restore(self):
        testWindowContents = self.doTestWindowContents
        testActionResult = self.doTestActionResult
##         This test saves the clipboard, copies two letters
##         so the test CLIPISNOTEMPTY returns true
##         and the clipboard should be restored next
        actions.doKeystroke("testing")
        actions.doAction("<<selectall>><<copy>>{ctrl+end}")
        actions.doAction('CLIPSAVE')
        t = natqh.getClipboard()
        self.assert_equal("", t, "Clipboard should be empty now" ) 
        actions.doAction("{shift+left 2}<<copy>>{ctrl+end}")
        t = natqh.getClipboard()
        self.assert_equal("ng", t, "Clipboard should contain two letters now" ) 
        testActionResult(1, "CLIPISNOTEMPTY")
        actions.doAction("CLIPRESTORE")
        t = natqh.getClipboard()
        self.assert_equal("testing", t, "Clipboard should filled now" ) 
    def test_Empty_clipboard(self):
        testWindowContents = self.doTestWindowContents
        # This test first empties the clipboard, copies with no selection on
##         and tests if the clipboard is empty.
##         If it is so it restores the previous clipboard and exits
        testActionResult = self.doTestActionResult
        actions.doKeystroke("testing")
        actions.doAction("<<selectall>><<copy>>{ctrl+end}")
        actions.doAction('CLIPSAVE')
        t = natqh.getClipboard()
        self.assert_equal("", t, "Clipboard should be empty now" ) 
        actions.doAction("<<copy>>")
        t = natqh.getClipboard()
        self.assert_equal("", t, "Clipboard should still be empty" ) 
        testActionResult(0, "CLIPISNOTEMPTY")
        ## with empty clipboard restore goes automatically: 
##        actions.doAction("CLIPRESTORE")
        t = natqh.getClipboard()
        self.assert_equal("testing", t, "Clipboard should filled again" ) 
Beispiel #15
0
    def test_matchModule(self):
        """check if dragonpad is reported as top window

        and the open dialog as child window

         behaviour changed in python version 2.3.4!!
        """
        progInfo = natqh.getProgInfo()
        self.log("progInfo: %s" % ` progInfo `)
        actions.doAction("LW")
        ## changed in 2013 from 3 to 4 items:
        self.assert_equal(4, len(progInfo), "progInfo should be tuple of 4")
        self.assert_equal(u'top', progInfo[2],
                          "DragonPad should be a top window")
        actions.doAction("<<fileopen>>")
        progInfo = natqh.getProgInfo()
        actions.doAction("{esc}")
        self.assert_equal(4, len(progInfo), "progInfo should be tuple of 4")
        self.assert_equal(u'child', progInfo[2],
                          "DragonPad open dialog should be a child window")
 def setUp(self):
     actions.doAction("BRINGUP dragonpad; <<selectall>><<delete>>")
Beispiel #17
0
 def log(self, mess):
     if type(mess) == types.StringType:
         actions.doAction(mess)
     else:
         actions.doAction(str(mess))
Beispiel #18
0
 def tearDown(self):
     actions.doAction("BRINGUP dragonpad; KW")
Beispiel #19
0
 def setUp(self):
     actions.doAction("BRINGUP dragonpad")