diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-02 13:22:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-05 14:43:18 +0200 |
commit | 68961653f9af29b332039e50459e29d33c623013 (patch) | |
tree | 4add04600b2fec881ce4eef4c28939c7f85bd4b4 /bin | |
parent | 9742c9e40fc2e104eaa806b8f02014055d37ed68 (diff) |
lint-ui: validate has_default and can_default
check that if a widget has has_default=='True', then it also
has can_default=='True'
Change-Id: Ie51d9d8fff6d7cc0cc42a09331f59e7ef6d559be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103834
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/lint-ui.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bin/lint-ui.py b/bin/lint-ui.py index 4f13320a23f3..a4631e760b4c 100755 --- a/bin/lint-ui.py +++ b/bin/lint-ui.py @@ -76,6 +76,17 @@ def check_top_level_widget(element): lint_assert(border_width.text == BORDER_WIDTH, "Top level 'border_width' property should be " + BORDER_WIDTH, border_width) + # check that any widget which has 'has-default' also has 'can-default' + for widget in element.findall('.//object'): + if not widget.attrib['class']: + continue + widget_type = widget.attrib['class'] + has_defaults = widget.findall("./property[@name='has_default']") + if len(has_defaults) > 0 and has_defaults[0].text == "True": + can_defaults = widget.findall("./property[@name='can_default']") + lint_assert(len(can_defaults)>0 and can_defaults[0].text == "True", + "has_default without can_default in " + widget_type + " with id = '" + widget.attrib['id'] + "'", widget) + def check_button_box_spacing(element): spacing = element.findall("property[@name='spacing']") lint_assert(len(spacing) > 0 and spacing[0].text == BUTTON_BOX_SPACING, @@ -121,7 +132,6 @@ def check_check_buttons(root): if len(radio_underlines) < 1: lint_assert(False, "No use_underline in GtkCheckButton with id = '" + radio.attrib['id'] + "'", radio) - def check_frames(root): frames = [element for element in root.findall('.//object') if element.attrib['class'] == 'GtkFrame'] for frame in frames: |