gtk: Give the TestCaseView a show-messages signal

This simply passes on the signal from the underlying factory to be used
in a higher up layer.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
This commit is contained in:
Anna Schumaker 2023-08-30 16:19:33 -04:00
parent 5a25935fed
commit 54be8f5ce3
2 changed files with 19 additions and 1 deletions

View File

@ -245,10 +245,17 @@ class TestTestCaseView(unittest.TestCase):
def test_make_factory(self):
"""Test the do_make_factory() implementation."""
show_messages = unittest.mock.Mock()
self.view.connect("show-messages", show_messages)
factory = self.view.do_make_factory("xunit-1")
self.assertIsInstance(factory, xfstestsdb.gtk.row.ResultFactory)
self.assertEqual(factory.xunit, "xunit-1")
factory.emit("show-messages", "testcase", "xunit", "stdout", "stderr")
show_messages.assert_called_with(self.view, "testcase", "xunit",
"stdout", "stderr")
class TestSummaryView(unittest.TestCase):
"""Tests the SummaryView."""

View File

@ -148,9 +148,20 @@ class TestCaseView(XunitView):
self.props.child.set_vexpand(True)
def __show_messages(self, factory: row.ResultFactory, testcase: str,
xunit: str, stdout: str, stderr: str) -> None:
self.emit("show-messages", testcase, xunit, stdout, stderr)
def do_make_factory(self, xunit: str) -> row.ResultFactory:
"""Make a new ResultFactory instance."""
return row.ResultFactory(xunit=xunit)
factory = row.ResultFactory(xunit=xunit)
factory.connect("show-messages", self.__show_messages)
return factory
@GObject.Signal(arg_types=(str, str, str, str))
def show_messages(self, testcase: str, xunit: str,
stdout: str, stderr: str) -> None:
"""Signal that the user wants to inspect stdout and stderr messages."""
class SummaryView(XunitView):