41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
# Copyright 2022 (c) Anna Schumaker.
|
|
"""Test that the gi.repository has been configured correctly."""
|
|
import unittest
|
|
import pathlib
|
|
import emmental
|
|
import gi
|
|
|
|
|
|
class TestGSetup(unittest.TestCase):
|
|
"""GObject Introspection configuration test case."""
|
|
|
|
def test_require_version(self):
|
|
"""Check that gi.require_version() has been called."""
|
|
self.assertEqual(gi.get_required_version("Gtk"), "4.0")
|
|
self.assertEqual(gi.get_required_version("Adw"), "1")
|
|
|
|
def test_adw(self):
|
|
"""Check that libadwaita style has been set."""
|
|
style = gi.repository.Adw.StyleManager.get_default()
|
|
self.assertEqual(style.get_color_scheme(),
|
|
gi.repository.Adw.ColorScheme.DEFAULT)
|
|
|
|
def test_import(self):
|
|
"""Check that modules have been imported."""
|
|
self.assertIsNotNone(emmental.gsetup.gi)
|
|
|
|
def test_application_id(self):
|
|
"""Check that the application id is generated properly."""
|
|
self.assertEqual(emmental.gsetup.DEBUG_STR, "-debug")
|
|
self.assertEqual(emmental.gsetup.APPLICATION_ID,
|
|
"com.nowheycreamery.emmental-debug")
|
|
|
|
def test_css(self):
|
|
"""Check that our custom stylesheet is configured."""
|
|
path = pathlib.Path(emmental.__file__).parent / "emmental.css"
|
|
self.assertEqual(emmental.gsetup.CSS_FILE, path)
|
|
self.assertEqual(emmental.gsetup.CSS_PRIORITY,
|
|
gi.repository.Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
|
self.assertIsInstance(emmental.gsetup.CSS_PROVIDER,
|
|
gi.repository.Gtk.CssProvider)
|