emmental/rind/test_gtk.py

29 lines
926 B
Python

# Copyright 2019 (c) Anna Schumaker.
from . import gtk
import curds
import time
import unittest
from gi.repository import Gtk
class TestGtk(unittest.TestCase):
def test_builder(self):
self.assertIsInstance(gtk.Builder, Gtk.Builder)
self.assertIsInstance(gtk.Builder.get_object("window"), Gtk.ApplicationWindow)
def test_window(self):
window = gtk.Builder.get_object("window")
self.assertIsInstance(window, Gtk.ApplicationWindow)
self.assertIsNone(gtk.Application.window)
self.assertEqual(window.get_title(), "Emmental")
thread = curds.ThreadQueue()
thread.push(gtk.Application.run)
while gtk.Application.window == None:
time.sleep(0.1)
self.assertTrue(window.is_visible())
gtk.Application.quit()
thread.stop()
def test_application(self):
self.assertIsInstance(gtk.Application, Gtk.Application)