Exemplo n.º 1
0
    def test_forgotten_end_fill(self):
        # SETUP
        expected_report = """\
create_line
    0
    0
    100
    0
    fill='#ff0000'
    pensize=1
create_line
    100
    0
    100
    100
    fill='#ff0000'
    pensize=1
"""
        
        # EXEC
        t = MockTurtle()
        t.color('red', 'blue')
        t.begin_fill()
        for _ in range(2):
            t.fd(100)
            t.right(90)
        report = t.report
        
        # VERIFY
        self.assertEqual(expected_report.splitlines(), report)
Exemplo n.º 2
0
    def test_forgotten_end_fill(self):
        # SETUP
        expected_report = """\
create_line
    0
    0
    100
    0
    fill='#ff0000'
    pensize=1
create_line
    100
    0
    100
    100
    fill='#ff0000'
    pensize=1
"""

        # EXEC
        t = MockTurtle()
        t.color('red', 'blue')
        t.begin_fill()
        for _ in range(2):
            t.fd(100)
            t.right(90)
        report = t.report

        # VERIFY
        self.assertEqual(expected_report.splitlines(), report)
Exemplo n.º 3
0
    def test_is_filling(self):
        # SETUP

        # EXEC
        t = MockTurtle()
        is_filling1 = t.fill()
        t.begin_fill()
        is_filling2 = t.fill()
        t.end_fill()
        is_filling3 = t.fill()

        # VERIFY
        self.assertFalse(is_filling1)
        self.assertTrue(is_filling2)
        self.assertFalse(is_filling3)
Exemplo n.º 4
0
    def test_is_filling(self):
        # SETUP

        # EXEC
        t = MockTurtle()
        is_filling1 = t.fill()
        t.begin_fill()
        is_filling2 = t.fill()
        t.end_fill()
        is_filling3 = t.fill()

        # VERIFY
        self.assertFalse(is_filling1)
        self.assertTrue(is_filling2)
        self.assertFalse(is_filling3)
Exemplo n.º 5
0
    def test_fill(self):
        # SETUP
        expected_report = """\
create_polygon
    0
    0
    100
    0
    100
    100
    fill='#0000ff'
    outline=''
create_line
    0
    0
    100
    0
    fill='#ff0000'
    pensize=1
create_line
    100
    0
    100
    100
    fill='#ff0000'
    pensize=1"""

        # EXEC
        t = MockTurtle()
        t.color("red", "blue")
        t.begin_fill()
        for _ in range(2):
            t.fd(100)
            t.right(90)
        t.end_fill()
        report = t.report

        # VERIFY
        self.assertEqual(expected_report.splitlines(), report)