예제 #1
0
    def test_drag_overlapping(self):
        bottom = Frame(self.context)
        bottom.draggable = True
        bottom.bounds = Bounds(10, 10, 50, 50)
        bottom.set_color(StyleKeys.Background, RGBA(1, 0, 0, 1))

        top = Frame(self.context)
        top.draggable = True
        top.bounds = Bounds(20, 20, 50, 50)
        top.set_color(StyleKeys.Background, RGBA(0, 0, 1, 1))

        self.mouse.move_to(Point(30, 30))
        self.mouse.press(MouseButton.LEFT)
        self.mouse.move_to(Point(50, 50))
        self.mouse.release(MouseButton.LEFT)

        self.context.process()

        self.assertImage("drag_overlapping_top", self.context)

        self.mouse.move_to(Point(20, 20))
        self.mouse.press(MouseButton.LEFT)
        self.mouse.move_to(Point(40, 40))
        self.mouse.release(MouseButton.LEFT)

        self.context.process()

        self.assertImage("drag_overlapping_bottom", self.context)
예제 #2
0
    def test_draw(self):
        window1 = Frame(self.context)

        window1.bounds = Bounds(10, 20, 80, 60)

        window2 = Frame(self.context)

        window2.bounds = Bounds(50, 40, 50, 50)
        window2.set_color(StyleKeys.Background, RGBA(1, 0, 0, 1))

        self.context.process()

        self.assertImage("draw", self.context)
예제 #3
0
    def test_draw_children(self):
        window = Frame(self.context)

        window.bounds = Bounds(10, 20, 80, 60)
        window.set_color(StyleKeys.Background, RGBA(0.5, 0.5, 0.5, 1))

        child1 = Panel(self.context)

        child1.bounds = Bounds(10, 10, 40, 40)
        child1.set_color(StyleKeys.Background, RGBA(1, 0, 0, 1))

        child2 = Panel(self.context)

        child2.bounds = Bounds(30, 30, 40, 40)
        child2.set_color(StyleKeys.Background, RGBA(0, 0, 1, 1))

        window.add(child1)
        window.add(child2)

        self.context.process()

        self.assertImage("draw_children", self.context)