diff --git a/tests/gtk/test_window.py b/tests/gtk/test_window.py index 3d1d234..1be4dc5 100644 --- a/tests/gtk/test_window.py +++ b/tests/gtk/test_window.py @@ -38,21 +38,25 @@ class TestWindow(unittest.TestCase): self.assertEqual(self.window.headerbar.props.title_widget, self.window.title) - def test_child(self): - """Test the window child property.""" - self.assertIsInstance(self.window.headerbar.get_next_sibling(), - Adw.Bin) + def test_splitview(self): + """Check that the Window's splitview is set up correctly.""" + self.assertIsInstance(self.window._splitview, Adw.OverlaySplitView) + self.assertEqual(self.window.headerbar.get_next_sibling(), + self.window._splitview) + self.assertFalse(self.window._splitview.props.show_sidebar) + self.assertTrue(self.window._splitview.props.collapsed) + def test_content(self): + """Test the window content property.""" self.assertIsNone(self.window.child) self.window.child = Gtk.Label() - self.assertEqual(self.window.headerbar.get_next_sibling().props.child, + self.assertEqual(self.window._splitview.props.content, self.window.child) label = Gtk.Label() window2 = xfstestsdb.gtk.window.Window(child=label) self.assertEqual(window2.child, label) - self.assertEqual(window2.headerbar.get_next_sibling().props.child, - label) + self.assertEqual(window2._splitview.props.content, label) def test_runid(self): """Test the window runid property.""" diff --git a/xfstestsdb/gtk/window.py b/xfstestsdb/gtk/window.py index fd06acd..c6520ed 100644 --- a/xfstestsdb/gtk/window.py +++ b/xfstestsdb/gtk/window.py @@ -20,13 +20,17 @@ class Window(Adw.Window): content=Gtk.Box(orientation=Gtk.Orientation.VERTICAL), title=Adw.WindowTitle(title="xfstestsdb gtk"), headerbar=Adw.HeaderBar(), **kwargs) + self._splitview = Adw.OverlaySplitView(content=self.child, + collapsed=True, + show_sidebar=False) + self.headerbar.props.title_widget = self.title self.headerbar.add_css_class("flat") self.props.content.append(self.headerbar) - self.props.content.append(Adw.Bin(child=self.child)) + self.props.content.append(self._splitview) - self.bind_property("child", self.headerbar.get_next_sibling(), "child") + self.bind_property("child", self._splitview, "content") self.connect("notify::runid", self.__notify_runid) if __debug__: