Exemple #1
0
    def test_should_revert_state_after_pop(self):

        canvas = Canvas()
        set_state(canvas, STATE_1)
        canvas.push_state()
        set_state(canvas, STATE_2)

        canvas.pop_state()

        assert_same(self, STATE_1, get_state(canvas))
Exemple #2
0
    def test_should_apply_old_state_after_pop(self, mock_stroke_apply,
                                              mock_fill_apply):

        # given
        canvas = Canvas()
        set_state(canvas, STATE_1)
        canvas.push_state()
        set_state(canvas, STATE_2)

        # when
        canvas.pop_state()

        # then
        self.assertTrue(mock_stroke_apply.called)
        self.assertTrue(mock_fill_apply.called)
Exemple #3
0
 def test_should_not_pop_state_from_empty_stack(self):
     canvas = Canvas()
     canvas.pop_state()