From 7a65956195ef0eccd6077edd1cfba8109107464c Mon Sep 17 00:00:00 2001 From: James Westman Date: Mon, 1 Nov 2021 22:15:49 -0500 Subject: [PATCH] Bug fix, new test --- gtkblueprinttool/ast.py | 3 ++- tests/samples/strings.blp | 5 +++++ tests/samples/strings.ui | 8 ++++++++ tests/test_samples.py | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/samples/strings.blp create mode 100644 tests/samples/strings.ui diff --git a/gtkblueprinttool/ast.py b/gtkblueprinttool/ast.py index d2251f7..67ec208 100644 --- a/gtkblueprinttool/ast.py +++ b/gtkblueprinttool/ast.py @@ -43,7 +43,8 @@ class UI(AstNode): for i in self.children[Import]: try: - gir_ctx.add_namespace(i.gir_namespace) + if i.gir_namespace is not None: + gir_ctx.add_namespace(i.gir_namespace) except CompileError as e: self._gir_errors.append(e) diff --git a/tests/samples/strings.blp b/tests/samples/strings.blp new file mode 100644 index 0000000..6ea0f7d --- /dev/null +++ b/tests/samples/strings.blp @@ -0,0 +1,5 @@ +using Gtk 4.0; + +Label { + label: "Test 1 2 3\n & 4 \"5\" 6"; +} diff --git a/tests/samples/strings.ui b/tests/samples/strings.ui new file mode 100644 index 0000000..6350ddf --- /dev/null +++ b/tests/samples/strings.ui @@ -0,0 +1,8 @@ + + + + + Test 1 2 3 + & 4 "5" 6 + + diff --git a/tests/test_samples.py b/tests/test_samples.py index bdaa92d..08d376e 100644 --- a/tests/test_samples.py +++ b/tests/test_samples.py @@ -62,6 +62,7 @@ class TestSamples(unittest.TestCase): self.assert_sample("menu") self.assert_sample("property") self.assert_sample("signal") + self.assert_sample("strings") self.assert_sample("style") self.assert_sample("template") self.assert_sample("using")