Exemple #1
0
 def test_no_new_line_to_both_file_and_stdout(self):
     dogtail.config.config.logDebugToFile = True
     logger = dogtail.logging.Logger("log", file=True, stdOut=True)
     output = trap_stdout(
         logger.log, {'message': 'hello world', 'newline': False})
     self.assertTrue("hello world" in output)
     self.assertTrue("hello world " in open(logger.fileName, 'r').read())
Exemple #2
0
 def test_focusing_bogus_name_without_a_fatal_error(self):
     config.fatalErrors = False
     output = trap_stdout(focus.widget, "should not be found")
     self.assertIsNone(focus.widget.node)
     self.assertIn(
         'The requested widget could not be focused: child with name="should not be found"',
         output)
Exemple #3
0
    def test_dump_with_actions(self):
        child = self.app.child('Builder')
        output = trap_stdout(child.dump)
        self.assertEquals(
            output, """[table cell | Builder]
 [action | edit |  ]
 [action | expand or contract |  ]
 [action | activate |  ]""")
Exemple #4
0
    def test_dump_with_actions(self):
        child = self.app.child('Builder')
        output = trap_stdout(child.dump)
        self.assertEqual(
            output,
            """[table cell | Builder]
 [action | edit |  ]
 [action | expand or contract |  ]
 [action | activate |  ]""")
Exemple #5
0
    def test_dump_to_stdout(self):
        child = self.app.child('Source')
        output = trap_stdout(child.dump)
        self.assertEquals(
            output, """[page tab | Source]
 [scroll pane | ]
  [text | ]
  [scroll bar | ]
  [scroll bar | ]""")
Exemple #6
0
    def test_dump_to_stdout(self):
        child = self.app.child('Source')
        output = trap_stdout(child.dump)
        self.assertEqual(
            output,
            """[page tab | Source]
 [scroll pane | ]
  [text | ]
  [scroll bar | ]
  [scroll bar | ]""")
Exemple #7
0
    def test_custom_actions_text_with_debug(self):
        self.runDemo('Builder')
        focus.window('GtkBuilder demo')
        config.debugSearching = True
        output = trap_stdout(click.text, '')
        self.assertIn(
            u"searching for descendent of [frame | GtkBuilder demo]: child with roleName='text'",
            output)

        self.assert_(isinstance(focus.widget.node, tree.Node))
        self.assertEquals(focus.widget.node.role, pyatspi.ROLE_TEXT)
Exemple #8
0
    def test_action_on_insensitive(self):
        self.runDemo("Assistant")
        wnd = self.app.child("Page 1", roleName='frame')
        child = wnd.child("Next")
        config.ensureSensitivity = True
        with self.assertRaises(NotSensitiveError):
            child.actions['click'].do()
        config.ensureSensitivity = False
        output = trap_stdout(child.actions['click'].do)
        self.assertEqual(
            output, """click on [push button | Next]
Warning: Cannot click [push button | Next]. It is not sensitive.""")
    def test_action_on_insensitive(self):
        self.runDemo("Assistant")
        wnd = self.app.child("Page 1", roleName='frame')
        child = wnd.child("Next")
        config.ensureSensitivity = True
        with self.assertRaises(NotSensitiveError):
            child.actions['click'].do()
        config.ensureSensitivity = False
        output = trap_stdout(child.actions['click'].do)
        self.assertEqual(
            output,
            """click on [push button | Next]
Warning: Cannot click [push button | Next]. It is not sensitive.""")
Exemple #10
0
 def test_dump_to_stdout(self):
     child = self.app.child("Source")
     output = trap_stdout(child.dump)
     self.assertEquals(
         output,
         """[page tab | Source]
          [scroll pane | ]
           [text | ]
           [scroll bar | ]
            [action | activate |  ]
           [scroll bar | ]
            [action | activate |  ]""",
     )
Exemple #11
0
    def test_action_on_insensitive(self):
        self.runDemo("Assistant")
        wnd = focus.application.node.window("Sample assistant (1 of 4)")
        child = wnd.child("Continue")
        config.ensureSensitivity = True
        with self.assertRaises(NotSensitiveError):
            child.actions['click'].do()
        config.ensureSensitivity = False
        output = trap_stdout(child.actions['click'].do)
        self.assertEquals(
            output,
            u"""click on [push button | Continue]
Warning: Cannot click [push button | Continue]. It is not sensitive.""")
    def test_custom_actions_text_with_debug(self):
        self.runDemo('Builder')
        try:
            wnd = self.app.child('GtkBuilder demo', roleName='frame', recursive=False, retry=False)
        except SearchError:
            wnd = self.app.child('Builder', roleName='frame', recursive=False, retry=False)
        focus.window(wnd.name)
        config.debugSearching = True
        output = trap_stdout(click.text, '')
        self.assertIn(
            "searching for descendent of [frame | %s]: child with roleName='text'" % wnd.name,
            output)

        self.assertTrue(isinstance(focus.widget.node, tree.Node))
        self.assertEqual(focus.widget.node.role, pyatspi.ROLE_TEXT)
Exemple #13
0
    def test_custom_actions_text_with_debug(self):
        self.runDemo('Builder')
        try:
            wnd = self.app.child('GtkBuilder demo',
                                 roleName='frame',
                                 recursive=False,
                                 retry=False)
        except SearchError:
            wnd = self.app.child('Builder',
                                 roleName='frame',
                                 recursive=False,
                                 retry=False)
        focus.window(wnd.name)
        config.debugSearching = True
        output = trap_stdout(click.text, '')
        self.assertIn(
            "searching for descendent of [frame | %s]: child with roleName='text'"
            % wnd.name, output)

        self.assertTrue(isinstance(focus.widget.node, tree.Node))
        self.assertEqual(focus.widget.node.role, pyatspi.ROLE_TEXT)
Exemple #14
0
 def test_doDelay_logger(self):
     dogtail.utils.config.defaultDelay = 2.0
     dogtail.utils.config.debugSleep = True
     output = trap_stdout(dogtail.utils.doDelay).split()
     self.assertEqual(len(output), 3)
     self.assertEqual(float(output[2]), 2.0)
Exemple #15
0
 def test_focusing_bogus_name_without_a_fatal_error(self):
     config.fatalErrors = False
     output = trap_stdout(focus.dialog, "should not be found")
     self.assertEquals(focus.dialog.node, None)
     self.assertTrue(
         'The requested widget could not be focused: "should not be found" dialog' in output)
Exemple #16
0
 def test_no_new_line_to_stdout(self):
     dogtail.config.config.logDebugToFile = False
     logger = dogtail.logging.Logger("log", file=False, stdOut=True)
     output = trap_stdout(
         logger.log, {'message': 'hello world', 'newline': False})
     self.assertEqual(output, "hello world")
Exemple #17
0
 def test_results_logger_correct_dict(self):
     logger = dogtail.logging.ResultsLogger("log")
     output = trap_stdout(logger.log, {'entry': {'a': '1'}})
     self.assertEqual('a:      1' in output, True)
Exemple #18
0
 def test_focusing_bogus_name_without_fatal_error(self):
     config.fatalErrors = False
     output = trap_stdout(focus.application, "should not be found")
     self.assertTrue(
         'The requested widget could not be focused: "should not be found" application'
         in output)
Exemple #19
0
 def test_doDelay_logger(self):
     dogtail.utils.config.defaultDelay = 2.0
     dogtail.utils.config.debugSleep = True
     output = trap_stdout(dogtail.utils.doDelay).split()
     self.assertEqual(len(output), 3)
     self.assertEqual(float(output[2]), 2.0)
Exemple #20
0
 def testFocusingBogusNameWithoutAFatalError(self):
     config.fatalErrors = False
     output = trap_stdout(focus.widget, "should not be found")
     self.assertEquals(focus.widget.node, None)
     self.assertTrue(
         'The requested widget could not be focused: child with name="should not be found"' in output)
Exemple #21
0
 def testFocusingBogusNameWithoutAFatalError(self):
     config.fatalErrors = False
     output = trap_stdout(focus.application, "should not be found")
     self.assertTrue(
         'The requested widget could not be focused: "should not be found" application' in output)
 def test_focusing_bogus_name_without_a_fatal_error(self):
     config.fatalErrors = False
     output = trap_stdout(focus.widget, "should not be found")
     self.assertIsNone(focus.widget.node)
     self.assertIn('The requested widget could not be focused: child with name="should not be found"', output)
 def test_focusing_bogus_name_without_fatal_error(self):
     config.fatalErrors = False
     output = trap_stdout(focus.application, "should not be found")
     self.assertTrue('The requested widget could not be focused: "should not be found" application' in output)