Exemple #1
0
    def test_invoker(self):
        screen = Screen('hello world!!')
        client = ScreenInvoker()

        cut_command = CutCommand(screen, start=5, end=11)
        client.store_and_execute(cut_command)
        self.assertEquals('hello!!', screen.text)

        paste_command = PasteCommand(screen, offset=0)
        client.store_and_execute(paste_command)
        self.assertEquals(' worldhello!!', screen.text)

        copy_command = CopyCommand(screen, start=0, end=screen.length())
        client.store_and_execute(copy_command)

        paste_command2 = PasteCommand(screen, offset=0)
        client.store_and_execute(paste_command2)
        self.assertEquals(' worldhello!! worldhello!!', screen.text)

        #undo last paste
        client.undo_last()
        self.assertEquals(' worldhello!!', screen.text)

        #undo copy
        client.undo_last()
        self.assertEquals(' worldhello!!', screen.text)
        self.assertEquals('', screen.clipboard)

        #undo paste
        client.undo_last()
        self.assertEquals('hello!!', screen.text)

        #undo cut
        client.undo_last()
        self.assertEquals('hello world!!', screen.text)
Exemple #2
0
    def test_invoker(self):
        screen = Screen('hello world!!')
        client = ScreenInvoker()

        cut_command = CutCommand(screen, start=5, end=11)
        client.store_and_execute(cut_command)
        self.assertEquals('hello!!', screen.text)

        paste_command = PasteCommand(screen, offset=0)
        client.store_and_execute(paste_command)
        self.assertEquals(' worldhello!!', screen.text)

        copy_command = CopyCommand(screen, start=0, end=screen.length())
        client.store_and_execute(copy_command)

        paste_command2 = PasteCommand(screen, offset=0)
        client.store_and_execute(paste_command2)
        self.assertEquals(' worldhello!! worldhello!!', screen.text)

        #undo last paste
        client.undo_last()
        self.assertEquals(' worldhello!!', screen.text)

        #undo copy
        client.undo_last()
        self.assertEquals(' worldhello!!', screen.text)
        self.assertEquals('', screen.clipboard)

        #undo paste
        client.undo_last()
        self.assertEquals('hello!!', screen.text)

        #undo cut
        client.undo_last()
        self.assertEquals('hello world!!', screen.text)
Exemple #3
0
 def test_paste(self):
     screen = Screen('hello world!!')
     screen.copy(start=0, end=5)
     screen.paste(screen.length())
     self.assertEquals('hello world!!hello', screen.text)
Exemple #4
0
 def test_paste(self):
     screen = Screen('hello world!!')
     screen.copy(start=0, end=5)
     screen.paste(screen.length())
     self.assertEquals('hello world!!hello', screen.text)