Preserve nested appearance style values

This commit is contained in:
2026-08-14 13:35:11 +03:00
parent 1a3624f3e0
commit 9f46d8e39e
2 changed files with 14 additions and 3 deletions
+3 -3
View File
@@ -259,14 +259,14 @@ def test_scd_payload_decoder_reads_xml_after_platform_prefix() -> None:
def test_appearance_payload_decoder_reads_xml_rules() -> None:
xml = """<?xml version="1.0" encoding="UTF-8"?>
<AppearanceTemplate><item><parameter>Заголовок</parameter><value>style:Title</value></item><appearance><item><parameter>ЦветФона</parameter><value type="Color" ref="style:Blue">style:Blue</value></item></appearance><style><name>Title</name></style></AppearanceTemplate>"""
<AppearanceTemplate><item><parameter>Заголовок</parameter><value>style:Title</value></item><appearance><item><parameter>ЦветФона</parameter><value type="Line" ref="style:Blue"><style type="Solid">Solid</style></value></item></appearance><style><name>Title</name></style></AppearanceTemplate>"""
result = inspect_appearance_payload(compress_payload(b"\x00\x01" + xml.encode("utf-8"), "raw_deflate"))
assert result["status"] == "ok"
assert result["items"] == [{"ordinal": 1, "parameter": "Заголовок", "value": "style:Title"}]
assert result["appearances"] == [{"ordinal": 1, "rules": [{"parameter": "ЦветФона", "value": "style:Blue", "value_type": "Color", "value_attributes": {"type": "Color", "ref": "style:Blue"}}]}]
assert result["outline"]["tag_counts"] == {"AppearanceTemplate": 1, "appearance": 1, "item": 2, "name": 1, "parameter": 2, "style": 1, "value": 2}
assert result["appearances"] == [{"ordinal": 1, "rules": [{"parameter": "ЦветФона", "value": "Solid", "value_type": "Line", "value_attributes": {"type": "Line", "ref": "style:Blue"}, "value_children": [{"tag": "style", "value": "Solid", "attributes": {"type": "Solid"}}]}]}]
assert result["outline"]["tag_counts"] == {"AppearanceTemplate": 1, "appearance": 1, "item": 2, "name": 1, "parameter": 2, "style": 2, "value": 2}
assert result["diagnostics"]["write"] == "unsupported_until_reverse_codec_fixture"