Merge lp:~sil2100/unity/autopilot_ibus_improve into lp:unity
Status: | Merged |
---|---|
Approved by: | Łukasz Zemczak |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3169 |
Proposed branch: | lp:~sil2100/unity/autopilot_ibus_improve |
Merge into: | lp:unity |
Diff against target: |
164 lines (+96/-10) 1 file modified
tests/autopilot/unity/tests/test_ibus.py (+96/-10) |
To merge this branch: | bzr merge lp:~sil2100/unity/autopilot_ibus_improve |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Thomi Richards (community) | Approve | ||
Review via email: mp+147951@code.launchpad.net |
Commit message
Improve IBus autopilot tests.
With these improvements, asian characters do not need to be hardcoded in the tests anymore. Now, the 'expected' values are taken directly from IBus before each test. We're doing it by using a separate input context and storing it for comparison. Using the existing input context was buggy, so this seemed like the best way to go otherwise.
To do this, I had to work-around the new IBus bindings from GIR, since create_
Description of the change
- Problem:
IBus tests are failing frequently. The reason is that we have hard-coded result values for IBus testing, where the results are not always the same - depending on search history and the ibus version. We also cannot easily clear the history.
- Fix:
My proposed fix is: let's poll (query) IBus with the input string, fetch the resulting string, and then start the standard IBus test and check the search entry text against it. We don't want to test IBus accuracy in our integration tests. We want to test if IBus integration works - if when IBus is enabled, that the input fields will have characters coming from IBus. That's why, we just compare if what we get on the search field is what IBus should return.
We do this by creating a new (separate) input context, feed it with the same input and fetch the resulting, committed strings as results. Best way of course would be to simply hook up to the existing input context of nux and the dash and just 'listen in' - this would be the *perfect* solution. Sadly, that didn't seem to be possible, as hooking up on the existing input context's signals did not work. Too bad...
So, this solution seems sufficient. It has some backsides, but in overall it should *finally* fix IBus tests.
Also, well, there are some hacks here too. The problem was - I could not use the old IBus bindings because of the glib version mismatching. The new bindings from GIR, well, those didn't allow introspection of create_
- Tests:
N/A
Hi,
First, when running the tests, I get:
/tmp/autopilot_ ibus_improve/ tests/autopilot /unity/ tests/test_ ibus.py: 48: PyGIDeprecation Warning: MainLoop is deprecated; use GLib.MainLoop instead
self._glibloop = GObject.MainLoop()
(autopilot:15226): IBUS-WARNING **: org.freedesktop .IBus.InputCont ext.GetEngine: GDBus.Error: org.freedesktop .IBus.Error. NoEngine: Input context does not have engine. ibus_improve/ tests/autopilot /unity/ tests/test_ ibus.py: 79: PyGIDeprecation Warning: timeout_add_seconds is deprecated; use GLib.timeout_ add_seconds instead timeout_ add_seconds( 10, lambda *args: self._glibloop. quit())
/tmp/autopilot_
GObject.
So we should fix that. Seconf, they enter an endless loop where they constantly print:
(autopilot:15226): IBUS-WARNING **: org.freedesktop .IBus.InputCont ext.GetEngine: GDBus.Error: org.freedesktop .DBus.Error. UnknownMethod: No such interface `org.freedeskto p.IBus. InputContext' on object at path /org/freedeskto p/IBus/ InputContext_ 58
so I can't actually run the tests to verify that they work as expected.