예제 #1
0
    def test_draw_screen(self):
        lines = [((x[0], None, "%s\n" % x[0]),) for x in TaurusConsole.palette]
        canvas = TestCanvas(lines)

        obj = GUIScreen()
        obj.register_palette(TaurusConsole.palette)

        obj.start()
        for _ in range(1, 10):
            obj.draw_screen((1, 1), canvas)
            time.sleep(0.5)

        old_font_size = obj.font['size']
        obj.root.event_generate("<Control-4>")
        obj.root.event_generate("<Control-MouseWheel>", delta=120)
        if old_font_size > 0:
            self.assertGreater(obj.font['size'], old_font_size)
        else:
            self.assertLess(obj.font['size'], old_font_size)
        obj.root.event_generate("<Control-5>")
        obj.root.event_generate("<Control-MouseWheel>", delta=-120)

        self.assertEqual(obj.font['size'], old_font_size)

        obj.stop()
예제 #2
0
    def test_draw_screen(self):
        lines = [((x[0], None, "%s\n" % x[0]), )
                 for x in TaurusConsole.palette]
        canvas = TestCanvas(lines)

        obj = Screen()
        """
        :type: bzt.modules.screen.GUIScreen
        """
        obj.register_palette(TaurusConsole.palette)

        obj.start()
        for _ in range(1, 10):
            obj.draw_screen((1, 1), canvas)
            time.sleep(0.5)

        if hasattr(obj, 'font'):
            old_font_size = obj.font['size']
            obj.root.event_generate("<Control-4>")
            obj.root.event_generate("<Control-MouseWheel>", delta=120)
            if old_font_size > 0:
                self.assertGreater(obj.font['size'], old_font_size)
            else:
                self.assertLess(obj.font['size'], old_font_size)
            obj.root.event_generate("<Control-5>")
            obj.root.event_generate("<Control-MouseWheel>", delta=-120)

            self.assertEqual(obj.font['size'], old_font_size)

        obj.stop()
예제 #3
0
 def test_window_closed(self):
     lines = [((x[0], None, "%s\n" % x[0]),) for x in TaurusConsole.palette]
     canvas = TestCanvas(lines)
     obj = Screen()
     obj.register_palette(TaurusConsole.palette)
     obj.start()
     for _ in range(5):
         obj.draw_screen((1, 1), canvas)
         time.sleep(0.1)
     # closing the window
     obj.closed_window()
     # first call to draw_screen should raise ManualShutdown
     self.assertRaises(ManualShutdown, obj.draw_screen, (1, 1), canvas)
     # consecutive calls to draw_screen shouldn't raise
     obj.draw_screen((1, 1), canvas)
     obj.draw_screen((1, 1), canvas)
예제 #4
0
 def test_window_closed(self):
     lines = [((x[0], None, "%s\n" % x[0]), )
              for x in TaurusConsole.palette]
     canvas = TestCanvas(lines)
     obj = Screen()
     obj.register_palette(TaurusConsole.palette)
     obj.start()
     for _ in range(5):
         obj.draw_screen((1, 1), canvas)
         time.sleep(0.1)
     # closing the window
     obj.closed_window()
     # first call to draw_screen should raise ManualShutdown
     self.assertRaises(ManualShutdown, obj.draw_screen, (1, 1), canvas)
     # consecutive calls to draw_screen shouldn't raise
     obj.draw_screen((1, 1), canvas)
     obj.draw_screen((1, 1), canvas)