decompile: Fix bug in lookup tags

A lookup tag with no type attribute would crash the decompiler, even if
that was valid. This wasn't caught by the tests since blueprint never
generates such XML.

Also fixed a bug in the tests that caused decompiler-only tests not to
run.
This commit is contained in:
James Westman 2025-04-25 20:13:01 -05:00
parent a83c7e936d
commit a12d3f5c81
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
5 changed files with 39 additions and 13 deletions

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<template class="GtkListItem">
<property name="child">
<object class="GtkLabel">
<binding name="label">
<lookup type="RecentObject" name="filename">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>

View file

@ -0,0 +1,7 @@
using Gtk 4.0;
template ListItem {
child: Label {
label: bind template.item as <$RecentObject>.filename;
};
}

View file

@ -181,11 +181,7 @@ class TestSamples(unittest.TestCase):
def test_samples(self):
# list the samples directory
samples = [
f.stem
for f in Path(__file__).parent.glob("samples/*.blp")
if not f.stem.endswith("_dec")
]
samples = [f.stem for f in Path(__file__).parent.glob("samples/*.blp")]
samples.sort()
for sample in samples:
REQUIRE_ADW_1_4 = ["adw_breakpoint"]
@ -215,7 +211,7 @@ class TestSamples(unittest.TestCase):
]
# Decompiler-only tests
SKIP_COMPILE = ["issue_177", "translator_comments"]
SKIP_COMPILE = ["issue_177", "issue_187", "translator_comments"]
SKIP_DECOMPILE = [
# Comments are not preserved in either direction
@ -228,7 +224,7 @@ class TestSamples(unittest.TestCase):
continue
with self.subTest(sample):
if sample not in SKIP_COMPILE:
if sample not in SKIP_COMPILE and not sample.endswith("_dec"):
self.assert_sample(sample, skip_run=sample in SKIP_RUN)
with self.subTest("decompile/" + sample):