diff --git a/tests/gtk/test_view.py b/tests/gtk/test_view.py index 6f452b1..c8d4252 100644 --- a/tests/gtk/test_view.py +++ b/tests/gtk/test_view.py @@ -317,6 +317,7 @@ class TestXfstestsView(unittest.TestCase): self.xfstestsdb.run(["xunit", "read", "--name", "xunit-2", "1", str(tests.xunit.XUNIT_1)]) + self.props = xfstestsdb.gtk.model.PropertyList(self.xfstestsdb.sql, 1) self.model = xfstestsdb.gtk.model.TestCaseList(self.xfstestsdb.sql, 1) self.summary = xfstestsdb.gtk.model.SummaryList(self.xfstestsdb.sql, 1) self.view = xfstestsdb.gtk.view.XfstestsView() @@ -326,11 +327,19 @@ class TestXfstestsView(unittest.TestCase): self.assertIsInstance(self.view, Gtk.Box) self.assertEqual(self.view.props.orientation, Gtk.Orientation.VERTICAL) + def test_property_view(self): + """Check that the XfstestsView sets up a PropertyView correctly.""" + self.assertIsInstance(self.view._propertyview, + xfstestsdb.gtk.view.PropertyView) + self.assertEqual(self.view.get_first_child(), self.view._propertyview) + def test_testcase_view(self): """Check that the XfstestsView sets up a TestCaseView correctly.""" + sep = self.view._propertyview.get_next_sibling() + self.assertIsInstance(sep, Gtk.Separator) self.assertIsInstance(self.view._testcaseview, xfstestsdb.gtk.view.TestCaseView) - self.assertEqual(self.view.get_first_child(), self.view._testcaseview) + self.assertEqual(sep.get_next_sibling(), self.view._testcaseview) def test_summary_view(self): """Check that the XfstestsView sets up a SummaryView correctly.""" @@ -340,6 +349,12 @@ class TestXfstestsView(unittest.TestCase): xfstestsdb.gtk.view.SummaryView) self.assertEqual(sep.get_next_sibling(), self.view._summaryview) + def test_properties(self): + """Test the XfstestsView 'properties' property.""" + self.assertIsNone(self.view.properties) + self.view.properties = self.props + self.assertEqual(self.view._propertyview.model, self.props) + def test_model(self): """Test the XfstestsView 'model' property.""" self.assertIsNone(self.view.model) diff --git a/tests/test_gtk.py b/tests/test_gtk.py index 0126b5c..ff02eb9 100644 --- a/tests/test_gtk.py +++ b/tests/test_gtk.py @@ -27,6 +27,7 @@ class TestApplication(unittest.TestCase): self.assertEqual(self.application.get_resource_base_path(), xfstestsdb.gtk.gsetup.RESOURCE_PATH) self.assertEqual(self.application.runid, 0) + self.assertIsNone(self.application.properties) self.assertIsNone(self.application.model) self.assertIsNone(self.application.summary) @@ -43,6 +44,7 @@ class TestApplication(unittest.TestCase): mock_cmd.get_arguments.assert_called() mock_activate.assert_called() self.assertEqual(self.application.runid, 0) + self.assertIsNone(self.application.properties) self.assertIsNone(self.application.model) self.assertIsNone(self.application.summary) @@ -56,6 +58,8 @@ class TestApplication(unittest.TestCase): mock_cmd.get_arguments.assert_called() mock_activate.assert_called() self.assertEqual(self.application.runid, 42) + self.assertIsInstance(self.application.properties, + xfstestsdb.gtk.model.PropertyList) self.assertIsInstance(self.application.model, xfstestsdb.gtk.model.TestCaseList) self.assertIsInstance(self.application.summary, @@ -86,6 +90,10 @@ class TestApplication(unittest.TestCase): self.application.runid = 42 self.assertEqual(self.application.win.runid, 42) + properties = xfstestsdb.gtk.model.PropertyList(self.xfstestsdb.sql, 42) + self.application.properties = properties + self.assertEqual(self.application.view.properties, properties) + model = xfstestsdb.gtk.model.TestCaseList(self.xfstestsdb.sql, 42) self.application.model = model self.assertEqual(self.application.view.model, model) diff --git a/xfstestsdb/gtk/__init__.py b/xfstestsdb/gtk/__init__.py index b04a7ff..5fa0ab9 100644 --- a/xfstestsdb/gtk/__init__.py +++ b/xfstestsdb/gtk/__init__.py @@ -18,6 +18,7 @@ class Application(Adw.Application): """Our Adw.Application for displaying xfstests results.""" runid = GObject.Property(type=int) + properties = GObject.Property(type=model.PropertyList) summary = GObject.Property(type=model.SummaryList) model = GObject.Property(type=model.TestCaseList) win = GObject.Property(type=window.Window) @@ -40,6 +41,7 @@ class Application(Adw.Application): match split[0]: case "runid": self.runid = int(split[1]) + self.properties = model.PropertyList(self.sql, self.runid) self.model = model.TestCaseList(self.sql, self.runid) self.summary = model.SummaryList(self.sql, self.runid) @@ -56,6 +58,7 @@ class Application(Adw.Application): self.win.headerbar.pack_end(self.view.filterbuttons) self.bind_property("runid", self.win, "runid") + self.bind_property("properties", self.view, "properties") self.bind_property("model", self.view, "model") self.bind_property("summary", self.view, "summary") self.add_window(self.win) diff --git a/xfstestsdb/gtk/view.py b/xfstestsdb/gtk/view.py index d018beb..964aa8f 100644 --- a/xfstestsdb/gtk/view.py +++ b/xfstestsdb/gtk/view.py @@ -168,18 +168,23 @@ class SummaryView(Gtk.ScrolledWindow): class XfstestsView(Gtk.Box): """A widget to display the results of an Xfstests runs.""" + properties = GObject.Property(type=PropertyList) model = GObject.Property(type=TestCaseList) summary = GObject.Property(type=SummaryList) def __init__(self): """Initialize an XfstestsView.""" super().__init__(orientation=Gtk.Orientation.VERTICAL) + self._propertyview = PropertyView() self._testcaseview = TestCaseView() self._summaryview = SummaryView() + self.bind_property("properties", self._propertyview, "model") self.bind_property("model", self._testcaseview, "model") self.bind_property("summary", self._summaryview, "model") + self.append(self._propertyview) + self.append(Gtk.Separator()) self.append(self._testcaseview) self.append(Gtk.Separator()) self.append(self._summaryview)