pida-hacks / tests / ui / test_views.py

from unittest import TestCase

from pida.utils.testing import refresh_gui

from pida.ui.views import PidaView


class TestView(PidaView):

    builder_file = 'test_view'
    clicked = False
    def on_b1__clicked(self, button):
        self.clicked = True

def pytest_funcarg__view(request):
    view = TestView(None)
    refresh_gui()
    return view


def test_has_toplevel(view):
    assert view.get_toplevel() is not None

def test_has_no_parent(view):
    assert view.get_toplevel().get_parent() is None

def test_event_callback(view):
    assert not view.clicked
    view.b1.clicked()
    refresh_gui()
    assert view.clicked

def test_actions(view):
    assert not view.clicked
    view.test_act.activate()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.