bin/ui-rules-enforcer.py | 11 +++++++++++ 1 file changed, 11 insertions(+)
New commits: commit 90705b67729c849acc7cf196fffa8a2d3c86dc13 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Nov 14 16:43:40 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Nov 15 12:35:08 2021 +0100 add a rule to enforce not sharing adjustments between widgets Change-Id: I44e9548c41de2ea4816d5b87d7491ad06a46f111 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125204 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/bin/ui-rules-enforcer.py b/bin/ui-rules-enforcer.py index fe1709bf36da..7c20ee0a6db7 100755 --- a/bin/ui-rules-enforcer.py +++ b/bin/ui-rules-enforcer.py @@ -513,6 +513,16 @@ def enforce_button_always_show_image(current): else: always_show_image.text = "True" +def enforce_noshared_adjustments(current, adjustments): + for child in current: + enforce_noshared_adjustments(child, adjustments) + if child.tag == "property": + attributes = child.attrib + if attributes.get("name") == "adjustment": + if child.text in adjustments: + raise Exception(sys.argv[1] + ': adjustment used more than once', child.text) + adjustments.add(child.text) + with open(sys.argv[1], encoding="utf-8") as f: header = f.readline() f.seek(0) @@ -549,6 +559,7 @@ remove_skip_pager_hint(root) remove_toolbutton_focus(root) enforce_toolbar_can_focus(root) enforce_button_always_show_image(root) +enforce_noshared_adjustments(root, set()) with open(sys.argv[1], 'wb') as o: # without encoding='unicode' (and the matching encode("utf8")) we get &#XXXX replacements for non-ascii characters