Merge lp:~allanlesage/autopilot-gtk/suggested-matching-fix-changes into lp:~dbarth/autopilot-gtk/matching-fix

Proposed by Allan LeSage
Status: Needs review
Proposed branch: lp:~allanlesage/autopilot-gtk/suggested-matching-fix-changes
Merge into: lp:~dbarth/autopilot-gtk/matching-fix
Diff against target: 69 lines (+33/-3)
2 files modified
lib/GtkNode.cpp (+1/-3)
tests/autopilot/tests/test_matching_properties.py (+32/-0)
To merge this branch: bzr merge lp:~allanlesage/autopilot-gtk/suggested-matching-fix-changes
Reviewer Review Type Date Requested Status
David Barth Approve
Review via email: mp+165269@code.launchpad.net

Description of the change

Move test dir to tests as elsewhere in autopilot projects; switch logging to g_debug-style; add autopilot test suite to replicate offered shell-test.

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) wrote :

The changes look good. Maybe you should also remove the shell script with the tests.

review: Approve
Revision history for this message
Allan LeSage (allanlesage) wrote :

> The changes look good. Maybe you should also remove the shell script with the
> tests.

David, would you merge this into your branch and maybe make the change you suggest? When you've committed and pushed the change will show up in the original merge proposal, and I'll approve and Jenkins will do its merging work :) . . . .

Revision history for this message
David Barth (dbarth) wrote :

Le 23/05/2013 21:45, Allan LeSage a écrit :
>> The changes look good. Maybe you should also remove the shell script with the
>> tests.
> David, would you merge this into your branch and maybe make the change you suggest? When you've committed and pushed the change will show up in the original merge proposal, and I'll approve and Jenkins will do its merging work :) . . . .
I see that you've merged it in the end. Thanks Allan.

David

Unmerged revisions

44. By Allan LeSage

Add autopilot tests, switch to g_debug logging, move test dir to tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/GtkNode.cpp'
2--- lib/GtkNode.cpp 2013-05-22 10:24:44 +0000
3+++ lib/GtkNode.cpp 2013-05-22 23:33:25 +0000
4@@ -19,7 +19,6 @@
5
6 #include <string>
7 #include <gdk/gdk.h>
8-#include <iostream>
9 #include <sstream>
10
11 #include "GtkNode.h"
12@@ -183,7 +182,6 @@
13 const std::string& value) const {
14
15 // g_debug("attempting to match a node's property");
16- // yes we're transforming to strings and comparing there
17
18 if (name == "id") {
19 return value == std::to_string(GetObjectId());
20@@ -194,7 +192,7 @@
21 if (pspec == NULL)
22 return false;
23
24- // std::cout << " (" << g_type_name(G_PARAM_SPEC_VALUE_TYPE(pspec)) << ")" << std::endl;
25+ g_debug("Matching a property of type (%s).", g_type_name(G_PARAM_SPEC_VALUE_TYPE(pspec)));
26
27 if (pspec && G_PARAM_SPEC_VALUE_TYPE(pspec) == G_TYPE_INT) {
28 GValue dest_value = G_VALUE_INIT;
29
30=== renamed directory 'test' => 'tests'
31=== added directory 'tests/autopilot'
32=== added directory 'tests/autopilot/tests'
33=== added file 'tests/autopilot/tests/__init__.py'
34=== added file 'tests/autopilot/tests/test_matching_properties.py'
35--- tests/autopilot/tests/test_matching_properties.py 1970-01-01 00:00:00 +0000
36+++ tests/autopilot/tests/test_matching_properties.py 2013-05-22 23:33:25 +0000
37@@ -0,0 +1,32 @@
38+
39+
40+from autopilot.testcase import AutopilotTestCase
41+from testtools.matchers import NotEquals
42+
43+
44+
45+class PropertyMatchingTest(AutopilotTestCase):
46+
47+ def setUp(self):
48+ super(PropertyMatchingTest, self).setUp()
49+ self.app = self.launch_test_application('gedit')
50+
51+ def test_integer_matches(self):
52+ """Test property matching for integers.
53+
54+ Find an opaque GtkWindow in Gedit.
55+ """
56+
57+ opaque_window = self.app.select_many('GtkWindow', opacity=1)
58+ self.assertThat(opaque_window, NotEquals(None))
59+
60+
61+ def test_string_matches(self):
62+ """Match a string property.
63+
64+ Find an GtkImageMenuItem named 'BookmarkOpen' in Gedit.
65+ """
66+
67+ bookmark_open_item = self.app.select_single('GtkImageMenuItem',
68+ name='BookmarkOpen')
69+ self.assertThat(bookmark_open_item, NotEquals(None))

Subscribers

People subscribed via source and target branches

to all changes: