tests: dist: Catch atk names marked translatable

We aren't using them in a translatable way
This commit is contained in:
Cole Robinson 2018-10-07 14:43:49 -04:00
parent f1d169ad7b
commit b29f214834
6 changed files with 39 additions and 15 deletions

View File

@ -3,7 +3,6 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
import fileinput
import fnmatch
import glob
import imp
@ -120,7 +119,7 @@ class TestDist(unittest.TestCase):
failures = []
for filename in glob.glob("ui/*.ui"):
required_version = None
for line in fileinput.input(filename):
for line in open(filename).readlines():
# This is much faster than XML parsing the whole file
if not line.strip().startswith('<requires '):
continue
@ -146,3 +145,28 @@ class TestDist(unittest.TestCase):
minimum_version_str)
err += "\n".join([("%s version=%s" % tup) for tup in failures])
raise AssertionError(err)
def test_ui_translatable_atknames(self):
"""
We only use accessible names for uitests, they shouldn't be
marked as translatable
"""
failures = []
atkstr = "AtkObject::accessible-name"
for filename in glob.glob("ui/*.ui"):
for line in open(filename).readlines():
if atkstr not in line:
continue
if "translatable=" in line:
failures.append(filename)
break
if not failures:
return
err = "Some files incorrectly have translatable ATK names.\n"
err += "Run this command to fix:\n\n"
err += ("""sed -i -e 's/%s" translatable="yes"/%s"/g' """ %
(atkstr, atkstr))
err += " ".join(failures)
raise AssertionError(err)

View File

@ -156,7 +156,7 @@
<property name="draw_indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="autoconnect-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Autoconnect</property>
<property name="AtkObject::accessible-name">Autoconnect</property>
</object>
</child>
</object>
@ -173,7 +173,7 @@
<signal name="changed" handler="on_username_entry_changed" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="username-entry-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Username</property>
<property name="AtkObject::accessible-name">Username</property>
</object>
</child>
</object>
@ -280,7 +280,7 @@ are very limited. &lt;/small&gt;</property>
<property name="hexpand">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="uri-entry-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">uri-entry</property>
<property name="AtkObject::accessible-name">uri-entry</property>
</object>
</child>
</object>
@ -299,7 +299,7 @@ are very limited. &lt;/small&gt;</property>
<property name="max_width_chars">22</property>
<child internal-child="accessible">
<object class="AtkObject" id="uri-label-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">uri-label</property>
<property name="AtkObject::accessible-name">uri-label</property>
</object>
</child>
</object>

View File

@ -468,7 +468,7 @@
<signal name="changed" handler="on_create_conn_changed" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="create-conn-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">create-conn</property>
<property name="AtkObject::accessible-name">create-conn</property>
</object>
</child>
</object>
@ -895,7 +895,7 @@ bar</property>
<signal name="changed" handler="on_install_url_entry_changed" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="install-url-entry-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">install-url-entry</property>
<property name="AtkObject::accessible-name">install-url-entry</property>
</object>
</child>
</object>
@ -2030,7 +2030,7 @@ connections is not yet supported.&lt;/small&gt;</property>
<property name="climb_rate">1</property>
<child internal-child="accessible">
<object class="AtkObject" id="cpus-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">cpus</property>
<property name="AtkObject::accessible-name">cpus</property>
</object>
</child>
</object>

View File

@ -1541,7 +1541,7 @@
</child>
<child internal-child="accessible">
<object class="AtkObject" id="box14-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">os-tab</property>
<property name="AtkObject::accessible-name">os-tab</property>
</object>
</child>
</object>

View File

@ -14,7 +14,7 @@
<signal name="stop-search" handler="on_os_name_stop_search" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="os-name-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">oslist-entry</property>
<property name="AtkObject::accessible-name">oslist-entry</property>
</object>
</child>
</object>
@ -90,7 +90,7 @@ or use the "Generic" entry.</property>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="os-list-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">os-list</property>
<property name="AtkObject::accessible-name">os-list</property>
</object>
</child>
</object>
@ -113,7 +113,7 @@ or use the "Generic" entry.</property>
<signal name="toggled" handler="on_include_eol_toggled" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="include-eol-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">include-eol</property>
<property name="AtkObject::accessible-name">include-eol</property>
</object>
</child>
</object>
@ -127,7 +127,7 @@ or use the "Generic" entry.</property>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="vmm-oslist-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">oslist-popover</property>
<property name="AtkObject::accessible-name">oslist-popover</property>
</object>
</child>
</object>

View File

@ -521,7 +521,7 @@ Redirection:</property>
<signal name="changed" handler="on_prefs_add_spice_usbredir_changed" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="prefs-add-spice-usbredir-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">prefs-add-spice-usbredir</property>
<property name="AtkObject::accessible-name">prefs-add-spice-usbredir</property>
</object>
</child>
</object>