File: test_tool_scroll.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 (25 lines) | stat: -rw-r--r-- 649 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
from gi.repository import Gtk

from gaphas.tool.scroll import on_scroll, scroll_tool


def test_scroll_tool_returns_a_controller(view):
    tool = scroll_tool(view)

    assert isinstance(tool, Gtk.EventController)


def test_offset_changes(view, scrolled_window):
    tool = scroll_tool(view)
    view.add_controller(tool)
    view._scrolling.update_adjustments(100, 100, (0, 0, 100, 100))

    assert view.hadjustment
    assert view.vadjustment
    assert view._scrolling._hadjustment_handler_id
    assert view._scrolling._hadjustment_handler_id

    on_scroll(tool, 10, 10, 1)

    assert view.matrix[4] == -10
    assert view.matrix[5] == -10