File: test_tool_placement.py

package info (click to toggle)
python-gaphas 5.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,560 kB
  • sloc: python: 5,839; makefile: 17; sh: 2
file content (29 lines) | stat: -rw-r--r-- 667 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pytest
from gi.repository import Gtk

from gaphas.item import Element
from gaphas.tool.placement import PlacementState, on_drag_begin, placement_tool


@pytest.fixture
def tool_factory(connections):
    def tool_factory():
        return Element(connections)

    return tool_factory


def test_can_create_placement_tool(tool_factory):
    tool = placement_tool(tool_factory, 2)

    assert isinstance(tool, Gtk.Gesture)


def test_create_new_element(view, tool_factory, window):
    state = PlacementState(tool_factory, 2)
    tool = placement_tool(tool_factory, 2)
    view.add_controller(tool)

    on_drag_begin(tool, 0, 0, state)

    assert state.moving