From b85daf94830a3ca39d59237fdb07bc33ede1c450 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 24 Jan 2021 03:38:44 +0100 Subject: 100% re-write of the keyboard indicator in plain C. --- tests/autopilot/Makefile.am | 5 -- tests/autopilot/__init__.py | 6 --- tests/autopilot/test.sh | 6 --- tests/autopilot/tests/Makefile.am | 1 - tests/autopilot/tests/__init__.py | 0 tests/autopilot/tests/test_indicator_keyboard.py | 60 ------------------------ 6 files changed, 78 deletions(-) delete mode 100644 tests/autopilot/Makefile.am delete mode 100644 tests/autopilot/__init__.py delete mode 100755 tests/autopilot/test.sh delete mode 100644 tests/autopilot/tests/Makefile.am delete mode 100644 tests/autopilot/tests/__init__.py delete mode 100644 tests/autopilot/tests/test_indicator_keyboard.py (limited to 'tests/autopilot') diff --git a/tests/autopilot/Makefile.am b/tests/autopilot/Makefile.am deleted file mode 100644 index 2af361a7..00000000 --- a/tests/autopilot/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -autopilotdir = $(pythondir)/indicator_keyboard -autopilot_DATA = __init__.py - -autopilottestsdir = $(autopilotdir)/tests -autopilottests_DATA = tests/__init__.py tests/test_indicator_keyboard.py diff --git a/tests/autopilot/__init__.py b/tests/autopilot/__init__.py deleted file mode 100644 index c9bdd5c3..00000000 --- a/tests/autopilot/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- -# Copyright 2013 Canonical -# -# This file is part of indicator-keyboard. - -"""indicator-keyboard autopilot tests - top level package.""" diff --git a/tests/autopilot/test.sh b/tests/autopilot/test.sh deleted file mode 100755 index 7c3a0ad4..00000000 --- a/tests/autopilot/test.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -for name in `autopilot list tests | head -n -3 | tail -n +3` -do - autopilot run $name || exit 1 -done diff --git a/tests/autopilot/tests/Makefile.am b/tests/autopilot/tests/Makefile.am deleted file mode 100644 index 06deff91..00000000 --- a/tests/autopilot/tests/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -check_PYTHON = __init__.py test_indicator_keyboard.py diff --git a/tests/autopilot/tests/__init__.py b/tests/autopilot/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/autopilot/tests/test_indicator_keyboard.py b/tests/autopilot/tests/test_indicator_keyboard.py deleted file mode 100644 index 0ef197db..00000000 --- a/tests/autopilot/tests/test_indicator_keyboard.py +++ /dev/null @@ -1,60 +0,0 @@ -import autopilot.introspection.gtk -import os -import pyatspi.registry -import pyatspi.utils -import time -import unity.tests - -def print_accessible(root, level=0): - print level * ' ', root - - for node in root: - print_accessible(node, level + 1) - -def get_accessible_with_name_and_role(root, name, role): - is_accessible = lambda a: a.name == name and a.get_role_name() == role - return pyatspi.utils.findDescendant(root, is_accessible, True); - -def get_panel_accessible(root): - return get_accessible_with_name_and_role(root, 'unity-panel-service', 'application') - -def is_indicator_accessible(root): - return root.get_role_name() == 'panel' and \ - len(root) == 1 and \ - root[0].get_role_name() == 'image' and \ - len(root[0]) == 1 and \ - root[0][0].get_role_name() == 'menu' and \ - len(root[0][0]) > 3 and \ - root[0][0][-3].name == 'Character Map' and \ - root[0][0][-3].get_role_name() == 'check menu item' and \ - root[0][0][-2].name == 'Keyboard Layout Chart' and \ - root[0][0][-2].get_role_name() == 'check menu item' and \ - root[0][0][-1].name == 'Text Entry Settings...' and \ - root[0][0][-1].get_role_name() == 'check menu item' - -def get_indicator_accessible(root): - return pyatspi.utils.findDescendant(root, is_indicator_accessible, True) - -def get_accessible_index(root, node): - for i in xrange(len(root)): - if root[i] == node: - return i - - return -1 - -class IndicatorKeyboardTestCase(unity.tests.UnityTestCase): - - def setUp(self): - super(IndicatorKeyboardTestCase, self).setUp() - - registry = pyatspi.registry.Registry() - desktop = registry.getDesktop(0) - panel = get_panel_accessible(desktop) - self.indicator = get_indicator_accessible(panel) - - # This is needed on systems other than the EN locale - os.putenv("LC_ALL", "C") - self.addCleanup(os.unsetenv, "LC_ALL") - - def test_indicator(self): - print_accessible(self.indicator) -- cgit v1.2.3