Exemplo n.º 1
0
    def testRemoveStroke(self):
        s1 = Stroke()
        s1.append_point(Point(x=2, y=3))
        s1.append_point(Point(x=3, y=4))

        s2 = Stroke()
        s2.append_point(Point(x=2, y=3))
        s2.append_point(Point(x=3, y=4))

        w = Writing()
        w.append_stroke(s1)
        w.append_stroke(s2)

        w.remove_stroke(1)
        
        self.assertEquals(w.get_strokes(), [[(2,3),(3,4)]])
Exemplo n.º 2
0
    def testRemoveStroke(self):
        s1 = Stroke()
        s1.append_point(Point(x=2, y=3))
        s1.append_point(Point(x=3, y=4))

        s2 = Stroke()
        s2.append_point(Point(x=2, y=3))
        s2.append_point(Point(x=3, y=4))

        w = Writing()
        w.append_stroke(s1)
        w.append_stroke(s2)

        w.remove_stroke(1)

        self.assertEquals(w.get_strokes(), [[(2, 3), (3, 4)]])
Exemplo n.º 3
0
    def testReplaceStroke(self):
        s1 = Stroke()
        s1.append_point(Point(x=2, y=3))
        s1.append_point(Point(x=3, y=4))

        s2 = Stroke()
        s2.append_point(Point(x=2, y=3))
        s2.append_point(Point(x=3, y=4))

        w = Writing()
        w.append_stroke(s1)
        w.append_stroke(s2)  

        s3 = Stroke()      
        s3.append_point(Point(x=22, y=33))
        s3.append_point(Point(x=33, y=44))

        w.replace_stroke(1, s3)
        self.assertEquals(w.get_strokes(), [[(2,3),(3,4)],[(22,33),(33,44)]])
Exemplo n.º 4
0
    def testReplaceStroke(self):
        s1 = Stroke()
        s1.append_point(Point(x=2, y=3))
        s1.append_point(Point(x=3, y=4))

        s2 = Stroke()
        s2.append_point(Point(x=2, y=3))
        s2.append_point(Point(x=3, y=4))

        w = Writing()
        w.append_stroke(s1)
        w.append_stroke(s2)

        s3 = Stroke()
        s3.append_point(Point(x=22, y=33))
        s3.append_point(Point(x=33, y=44))

        w.replace_stroke(1, s3)
        self.assertEquals(w.get_strokes(), [[(2, 3),
                                             (3, 4)], [(22, 33), (33, 44)]])
Exemplo n.º 5
0
    def testNewWriting(self):
        writing = Writing()

        writing.move_to(0, 0)
        writing.line_to(1, 1)
        writing.line_to(2, 2)
        writing.line_to(3, 3)

        writing.move_to(4, 4)
        writing.line_to(5, 5)

        writing.move_to(6, 6)
        writing.line_to(7, 7)
        writing.line_to(8, 8)

        strokes = writing.get_strokes()
        expected = [[(0, 0), (1, 1), (2, 2), (3, 3)], [(4, 4), (5, 5)],
                    [(6, 6), (7, 7), (8, 8)]]

        self.assertEquals(strokes, expected)
Exemplo n.º 6
0
    def testNewWriting(self):
        writing = Writing()

        writing.move_to(0,0)
        writing.line_to(1,1)
        writing.line_to(2,2)
        writing.line_to(3,3)

        writing.move_to(4,4)
        writing.line_to(5,5)

        writing.move_to(6,6)
        writing.line_to(7,7)
        writing.line_to(8,8)

        strokes = writing.get_strokes()
        expected = [ [(0, 0), (1,1), (2,2), (3,3)],
                     [(4,4), (5,5)],
                     [(6,6), (7,7), (8,8)] ]

        self.assertEquals(strokes, expected)