Ejemplo n.º 1
0
    def test_not_clicked_when_mousepress_outside(self):
        """Given a button
            when mouse clicks outside
            then button shouldn't return clicked state"""
        # Given
        button = gui.Button(Rectangle(100, 100, 50, 50))
        userinput = UserInput()
        guistate = gui.GuiState()
        assert not button.went_down()

        # When
        userinput.mouse.feed_pos(Vec2D(110, 90))
        userinput.mouse.feed_down(Mouse.LEFT)
        button.tick(userinput, guistate)

        # Then
        assert not button.went_down()
Ejemplo n.º 2
0
 def test_init(self):
     button = gui.Button()