Merge lp:~sinzui/ubuntu/quantal/gedit-developer-plugins/0.5.15 into lp:ubuntu/quantal/gedit-developer-plugins
- Quantal (12.10)
- 0.5.15
- Merge into quantal
Proposed by
Curtis Hovey
Status: | Merged |
---|---|
Merged at revision: | 14 |
Proposed branch: | lp:~sinzui/ubuntu/quantal/gedit-developer-plugins/0.5.15 |
Merge into: | lp:ubuntu/quantal/gedit-developer-plugins |
Diff against target: |
864 lines (+339/-225) 11 files modified
ChangeLog (+39/-0) configure (+10/-10) configure.ac (+1/-1) debian/changelog (+6/-0) plugins/gdp/__init__.py (+7/-1) plugins/gdp/find.py (+35/-1) plugins/gdp/find.ui (+76/-209) plugins/gdp/tests/test_find.py (+100/-1) plugins/gdp/tests/test_gdp.py (+62/-0) testing/__init__.py (+2/-2) testing/testrunner.py (+1/-0) |
To merge this branch: | bzr merge lp:~sinzui/ubuntu/quantal/gedit-developer-plugins/0.5.15 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Pitt | Approve | ||
Review via email: mp+110820@code.launchpad.net |
Commit message
Description of the change
Update the package to the current release of 0.5.15. The release Fixes a few bugs in the the find panel and introduces a new UI for the find panel.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2012-03-30 14:24:59 +0000 | |||
3 | +++ ChangeLog 2012-06-18 13:32:54 +0000 | |||
4 | @@ -1,5 +1,44 @@ | |||
5 | 1 | <Generated by bzr log --log-format=gnu> | 1 | <Generated by bzr log --log-format=gnu> |
6 | 2 | 2 | ||
7 | 3 | 2012-06-16 Curtis Hovey <sinzui.is@verizon.net> | ||
8 | 4 | |||
9 | 5 | [579] Increment version. | ||
10 | 6 | |||
11 | 7 | 2012-04-28 Curtis Hovey <sinzui.is@verizon.net> | ||
12 | 8 | |||
13 | 9 | [578] Show relative path in find results. | ||
14 | 10 | |||
15 | 11 | 2012-04-28 Curtis Hovey <sinzui.is@verizon.net> | ||
16 | 12 | |||
17 | 13 | [577] Do not mutate gsettings. | ||
18 | 14 | |||
19 | 15 | 2012-04-28 Curtis Hovey <sinzui.is@verizon.net> | ||
20 | 16 | |||
21 | 17 | [576] Use the FileChooserDialog to set the directory to find in. | ||
22 | 18 | |||
23 | 19 | 2012-04-28 Curtis Hovey <sinzui.is@verizon.net> | ||
24 | 20 | |||
25 | 21 | [575] Extend object. | ||
26 | 22 | |||
27 | 23 | 2012-04-28 Curtis Hovey <sinzui.is@verizon.net> | ||
28 | 24 | |||
29 | 25 | [574] Warn when the directory path does not exist. Convert the path | ||
30 | 26 | from a uri to a directory path. | ||
31 | 27 | |||
32 | 28 | 2012-04-28 Curtis Hovey <sinzui.is@verizon.net> | ||
33 | 29 | |||
34 | 30 | [573] Added on_replace_in_files_icon_press for substituion entry. | ||
35 | 31 | |||
36 | 32 | 2012-04-28 Curtis Hovey <sinzui.is@verizon.net> | ||
37 | 33 | |||
38 | 34 | [572] Introduce on_find_in_files_icon_press to handle the icon-press | ||
39 | 35 | event from the entry. | ||
40 | 36 | |||
41 | 37 | 2012-04-10 Curtis Hovey <sinzui.is@verizon.net> | ||
42 | 38 | |||
43 | 39 | [571] Quick glade hack to make the panel use less space by using | ||
44 | 40 | secondary icons instead buttons. | ||
45 | 41 | |||
46 | 3 | 2012-03-29 Curtis Hovey <sinzui.is@verizon.net> | 42 | 2012-03-29 Curtis Hovey <sinzui.is@verizon.net> |
47 | 4 | 43 | ||
48 | 5 | [570] Do not look for missing in a branch without a parent. | 44 | [570] Do not look for missing in a branch without a parent. |
49 | 6 | 45 | ||
50 | === modified file 'configure' | |||
51 | --- configure 2012-03-30 14:24:59 +0000 | |||
52 | +++ configure 2012-06-18 13:32:54 +0000 | |||
53 | @@ -1,6 +1,6 @@ | |||
54 | 1 | #! /bin/sh | 1 | #! /bin/sh |
55 | 2 | # Guess values for system-dependent variables and create Makefiles. | 2 | # Guess values for system-dependent variables and create Makefiles. |
57 | 3 | # Generated by GNU Autoconf 2.68 for gedit-developer-plugins 0.5.14. | 3 | # Generated by GNU Autoconf 2.68 for gedit-developer-plugins 0.5.15. |
58 | 4 | # | 4 | # |
59 | 5 | # Report bugs to <sinzui.is@verizon.net>. | 5 | # Report bugs to <sinzui.is@verizon.net>. |
60 | 6 | # | 6 | # |
61 | @@ -560,8 +560,8 @@ | |||
62 | 560 | # Identity of this package. | 560 | # Identity of this package. |
63 | 561 | PACKAGE_NAME='gedit-developer-plugins' | 561 | PACKAGE_NAME='gedit-developer-plugins' |
64 | 562 | PACKAGE_TARNAME='gedit-developer-plugins' | 562 | PACKAGE_TARNAME='gedit-developer-plugins' |
67 | 563 | PACKAGE_VERSION='0.5.14' | 563 | PACKAGE_VERSION='0.5.15' |
68 | 564 | PACKAGE_STRING='gedit-developer-plugins 0.5.14' | 564 | PACKAGE_STRING='gedit-developer-plugins 0.5.15' |
69 | 565 | PACKAGE_BUGREPORT='sinzui.is@verizon.net' | 565 | PACKAGE_BUGREPORT='sinzui.is@verizon.net' |
70 | 566 | PACKAGE_URL='' | 566 | PACKAGE_URL='' |
71 | 567 | 567 | ||
72 | @@ -1319,7 +1319,7 @@ | |||
73 | 1319 | # Omit some internal or obsolete options to make the list less imposing. | 1319 | # Omit some internal or obsolete options to make the list less imposing. |
74 | 1320 | # This message is too long to be a string in the A/UX 3.1 sh. | 1320 | # This message is too long to be a string in the A/UX 3.1 sh. |
75 | 1321 | cat <<_ACEOF | 1321 | cat <<_ACEOF |
77 | 1322 | \`configure' configures gedit-developer-plugins 0.5.14 to adapt to many kinds of systems. | 1322 | \`configure' configures gedit-developer-plugins 0.5.15 to adapt to many kinds of systems. |
78 | 1323 | 1323 | ||
79 | 1324 | Usage: $0 [OPTION]... [VAR=VALUE]... | 1324 | Usage: $0 [OPTION]... [VAR=VALUE]... |
80 | 1325 | 1325 | ||
81 | @@ -1386,7 +1386,7 @@ | |||
82 | 1386 | 1386 | ||
83 | 1387 | if test -n "$ac_init_help"; then | 1387 | if test -n "$ac_init_help"; then |
84 | 1388 | case $ac_init_help in | 1388 | case $ac_init_help in |
86 | 1389 | short | recursive ) echo "Configuration of gedit-developer-plugins 0.5.14:";; | 1389 | short | recursive ) echo "Configuration of gedit-developer-plugins 0.5.15:";; |
87 | 1390 | esac | 1390 | esac |
88 | 1391 | cat <<\_ACEOF | 1391 | cat <<\_ACEOF |
89 | 1392 | 1392 | ||
90 | @@ -1491,7 +1491,7 @@ | |||
91 | 1491 | test -n "$ac_init_help" && exit $ac_status | 1491 | test -n "$ac_init_help" && exit $ac_status |
92 | 1492 | if $ac_init_version; then | 1492 | if $ac_init_version; then |
93 | 1493 | cat <<\_ACEOF | 1493 | cat <<\_ACEOF |
95 | 1494 | gedit-developer-plugins configure 0.5.14 | 1494 | gedit-developer-plugins configure 0.5.15 |
96 | 1495 | generated by GNU Autoconf 2.68 | 1495 | generated by GNU Autoconf 2.68 |
97 | 1496 | 1496 | ||
98 | 1497 | Copyright (C) 2010 Free Software Foundation, Inc. | 1497 | Copyright (C) 2010 Free Software Foundation, Inc. |
99 | @@ -1860,7 +1860,7 @@ | |||
100 | 1860 | This file contains any messages produced by compilers while | 1860 | This file contains any messages produced by compilers while |
101 | 1861 | running configure, to aid debugging if configure makes a mistake. | 1861 | running configure, to aid debugging if configure makes a mistake. |
102 | 1862 | 1862 | ||
104 | 1863 | It was created by gedit-developer-plugins $as_me 0.5.14, which was | 1863 | It was created by gedit-developer-plugins $as_me 0.5.15, which was |
105 | 1864 | generated by GNU Autoconf 2.68. Invocation command line was | 1864 | generated by GNU Autoconf 2.68. Invocation command line was |
106 | 1865 | 1865 | ||
107 | 1866 | $ $0 $@ | 1866 | $ $0 $@ |
108 | @@ -2675,7 +2675,7 @@ | |||
109 | 2675 | 2675 | ||
110 | 2676 | # Define the identity of the package. | 2676 | # Define the identity of the package. |
111 | 2677 | PACKAGE='gedit-developer-plugins' | 2677 | PACKAGE='gedit-developer-plugins' |
113 | 2678 | VERSION='0.5.14' | 2678 | VERSION='0.5.15' |
114 | 2679 | 2679 | ||
115 | 2680 | 2680 | ||
116 | 2681 | cat >>confdefs.h <<_ACEOF | 2681 | cat >>confdefs.h <<_ACEOF |
117 | @@ -6525,7 +6525,7 @@ | |||
118 | 6525 | # report actual input values of CONFIG_FILES etc. instead of their | 6525 | # report actual input values of CONFIG_FILES etc. instead of their |
119 | 6526 | # values after options handling. | 6526 | # values after options handling. |
120 | 6527 | ac_log=" | 6527 | ac_log=" |
122 | 6528 | This file was extended by gedit-developer-plugins $as_me 0.5.14, which was | 6528 | This file was extended by gedit-developer-plugins $as_me 0.5.15, which was |
123 | 6529 | generated by GNU Autoconf 2.68. Invocation command line was | 6529 | generated by GNU Autoconf 2.68. Invocation command line was |
124 | 6530 | 6530 | ||
125 | 6531 | CONFIG_FILES = $CONFIG_FILES | 6531 | CONFIG_FILES = $CONFIG_FILES |
126 | @@ -6582,7 +6582,7 @@ | |||
127 | 6582 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | 6582 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
128 | 6583 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" | 6583 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
129 | 6584 | ac_cs_version="\\ | 6584 | ac_cs_version="\\ |
131 | 6585 | gedit-developer-plugins config.status 0.5.14 | 6585 | gedit-developer-plugins config.status 0.5.15 |
132 | 6586 | configured by $0, generated by GNU Autoconf 2.68, | 6586 | configured by $0, generated by GNU Autoconf 2.68, |
133 | 6587 | with options \\"\$ac_cs_config\\" | 6587 | with options \\"\$ac_cs_config\\" |
134 | 6588 | 6588 | ||
135 | 6589 | 6589 | ||
136 | === modified file 'configure.ac' | |||
137 | --- configure.ac 2012-03-30 14:24:59 +0000 | |||
138 | +++ configure.ac 2012-06-18 13:32:54 +0000 | |||
139 | @@ -4,7 +4,7 @@ | |||
140 | 4 | 4 | ||
141 | 5 | m4_define(gdp_major_version, 0) | 5 | m4_define(gdp_major_version, 0) |
142 | 6 | m4_define(gdp_minor_version, 5) | 6 | m4_define(gdp_minor_version, 5) |
144 | 7 | m4_define(gdp_micro_version, 14) | 7 | m4_define(gdp_micro_version, 15) |
145 | 8 | m4_define(gdp_version, gdp_major_version.gdp_minor_version.gdp_micro_version) | 8 | m4_define(gdp_version, gdp_major_version.gdp_minor_version.gdp_micro_version) |
146 | 9 | 9 | ||
147 | 10 | AC_INIT(gedit-developer-plugins, gdp_version, sinzui.is@verizon.net) | 10 | AC_INIT(gedit-developer-plugins, gdp_version, sinzui.is@verizon.net) |
148 | 11 | 11 | ||
149 | === modified file 'debian/changelog' | |||
150 | --- debian/changelog 2012-03-30 14:30:40 +0000 | |||
151 | +++ debian/changelog 2012-06-18 13:32:54 +0000 | |||
152 | @@ -1,3 +1,9 @@ | |||
153 | 1 | gedit-developer-plugins (0.5.15-0ubuntu1) quantal; urgency=low | ||
154 | 2 | |||
155 | 3 | * New upstream release. Fixes LP:#990561, LP:#990585, LP:#990688 | ||
156 | 4 | |||
157 | 5 | -- Curtis C. Hovey <sinzui.is@verizon.net> Mon, 18 Jun 2012 09:25:07 -0400 | ||
158 | 6 | |||
159 | 1 | gedit-developer-plugins (0.5.14-0ubuntu1) precise; urgency=low | 7 | gedit-developer-plugins (0.5.14-0ubuntu1) precise; urgency=low |
160 | 2 | 8 | ||
161 | 3 | * New upstream bug-fix release. | 9 | * New upstream bug-fix release. |
162 | 4 | 10 | ||
163 | === modified file 'plugins/gdp/__init__.py' | |||
164 | --- plugins/gdp/__init__.py 2012-03-12 13:04:13 +0000 | |||
165 | +++ plugins/gdp/__init__.py 2012-06-18 13:32:54 +0000 | |||
166 | @@ -147,7 +147,13 @@ | |||
167 | 147 | text = model.get_value(piter, 3) | 147 | text = model.get_value(piter, 3) |
168 | 148 | if text is None: | 148 | if text is None: |
169 | 149 | if cell_type == 'text': | 149 | if cell_type == 'text': |
171 | 150 | cell.props.text = file_path | 150 | relative_file_path = file_path |
172 | 151 | base_dir = model.get_value(piter, 4) | ||
173 | 152 | if base_dir: | ||
174 | 153 | if base_dir[-1] != '/': | ||
175 | 154 | base_dir = '%s/' % base_dir | ||
176 | 155 | relative_file_path = file_path.replace(base_dir, './') | ||
177 | 156 | cell.props.text = relative_file_path | ||
178 | 151 | else: | 157 | else: |
179 | 152 | # cell_type == 'line_no' | 158 | # cell_type == 'line_no' |
180 | 153 | cell.props.text = '' | 159 | cell.props.text = '' |
181 | 154 | 160 | ||
182 | === modified file 'plugins/gdp/find.py' | |||
183 | --- plugins/gdp/find.py 2012-03-12 13:04:13 +0000 | |||
184 | +++ plugins/gdp/find.py 2012-06-18 13:32:54 +0000 | |||
185 | @@ -247,8 +247,13 @@ | |||
186 | 247 | def ui_callbacks(self): | 247 | def ui_callbacks(self): |
187 | 248 | """The dict of callbacks for the ui widgets.""" | 248 | """The dict of callbacks for the ui widgets.""" |
188 | 249 | return { | 249 | return { |
189 | 250 | 'on_choose_directory_icon_press': | ||
190 | 251 | self.on_choose_directory_icon_press, | ||
191 | 250 | 'on_find_in_files': self.on_find_in_files, | 252 | 'on_find_in_files': self.on_find_in_files, |
192 | 253 | 'on_find_in_files_icon_press': self.on_find_in_files_icon_press, | ||
193 | 251 | 'on_replace_in_files': self.on_replace_in_files, | 254 | 'on_replace_in_files': self.on_replace_in_files, |
194 | 255 | 'on_replace_in_files_icon_press': | ||
195 | 256 | self.on_replace_in_files_icon_press, | ||
196 | 252 | 'on_save_results': self.on_save_results, | 257 | 'on_save_results': self.on_save_results, |
197 | 253 | } | 258 | } |
198 | 254 | 259 | ||
199 | @@ -272,7 +277,8 @@ | |||
200 | 272 | path_ = '.' | 277 | path_ = '.' |
201 | 273 | elif path_ == self.CURRENT_FILE: | 278 | elif path_ == self.CURRENT_FILE: |
202 | 274 | document = self.active_document | 279 | document = self.active_document |
204 | 275 | path_ = os.path.dirname(document.get_uri_for_display()) | 280 | path_ = document.get_uri_for_display().replace('file://', '') |
205 | 281 | path_ = os.path.dirname(path_) | ||
206 | 276 | return path_ | 282 | return path_ |
207 | 277 | 283 | ||
208 | 278 | @property | 284 | @property |
209 | @@ -323,11 +329,31 @@ | |||
210 | 323 | self.widgets.get_object('match_case_checkbox').get_active(), | 329 | self.widgets.get_object('match_case_checkbox').get_active(), |
211 | 324 | self.file_pattern) | 330 | self.file_pattern) |
212 | 325 | 331 | ||
213 | 332 | def on_choose_directory_icon_press(self, widget, position, event): | ||
214 | 333 | """Choose a directory using a dialog.""" | ||
215 | 334 | dialog = Gtk.FileChooserDialog( | ||
216 | 335 | title="Choose a directory to find in", parent=self.window, | ||
217 | 336 | action=Gtk.FileChooserAction.SELECT_FOLDER, | ||
218 | 337 | buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, | ||
219 | 338 | Gtk.STOCK_OPEN, Gtk.ResponseType.ACCEPT)) | ||
220 | 339 | dialog.set_current_folder(os.getcwd()) | ||
221 | 340 | if dialog.run() == Gtk.ResponseType.ACCEPT: | ||
222 | 341 | path = dialog.get_filename() | ||
223 | 342 | if path: | ||
224 | 343 | self.path_comboentry.get_child().set_text(path) | ||
225 | 344 | dialog.destroy() | ||
226 | 345 | |||
227 | 326 | def on_find_in_files(self, widget=None, substitution=None): | 346 | def on_find_in_files(self, widget=None, substitution=None): |
228 | 327 | """Find and present the matches.""" | 347 | """Find and present the matches.""" |
229 | 328 | treestore = self.file_lines_view.get_model() | 348 | treestore = self.file_lines_view.get_model() |
230 | 329 | treestore.clear() | 349 | treestore.clear() |
231 | 330 | find_params = self.get_find_params() | 350 | find_params = self.get_find_params() |
232 | 351 | if (find_params.path != self.CURRENT_FILE | ||
233 | 352 | and not os.path.exists(find_params.path)): | ||
234 | 353 | message = 'The directory path does not exist!' | ||
235 | 354 | self.file_lines_view.get_model().append( | ||
236 | 355 | None, (message, 'stock_dialog-info', 0, None, None)) | ||
237 | 356 | return | ||
238 | 331 | self.last_find = find_params | 357 | self.last_find = find_params |
239 | 332 | pattern = find_params.pattern | 358 | pattern = find_params.pattern |
240 | 333 | self.save_find_data() | 359 | self.save_find_data() |
241 | @@ -339,6 +365,10 @@ | |||
242 | 339 | # of this method. | 365 | # of this method. |
243 | 340 | GObject.idle_add(find_worker.start) | 366 | GObject.idle_add(find_worker.start) |
244 | 341 | 367 | ||
245 | 368 | def on_find_in_files_icon_press(self, widget, position, event): | ||
246 | 369 | """Handle find pattern entry icon-press event.""" | ||
247 | 370 | self.on_find_in_files() | ||
248 | 371 | |||
249 | 342 | def on_find_complete(self): | 372 | def on_find_complete(self): |
250 | 343 | if self.path_comboentry.get_active_text() == self.CURRENT_FILE: | 373 | if self.path_comboentry.get_active_text() == self.CURRENT_FILE: |
251 | 344 | self.file_lines_view.expand_all() | 374 | self.file_lines_view.expand_all() |
252 | @@ -394,6 +424,10 @@ | |||
253 | 394 | elif response == Gtk.ResponseType.ACCEPT: | 424 | elif response == Gtk.ResponseType.ACCEPT: |
254 | 395 | self.on_find_in_files(substitution=substitution) | 425 | self.on_find_in_files(substitution=substitution) |
255 | 396 | 426 | ||
256 | 427 | def on_replace_in_files_icon_press(self, widget, position, event): | ||
257 | 428 | """Handle replace pattern entry icon-press event.""" | ||
258 | 429 | self.on_replace_in_files() | ||
259 | 430 | |||
260 | 397 | def on_save_results(self, widget=None): | 431 | def on_save_results(self, widget=None): |
261 | 398 | """Save the search results to a file.""" | 432 | """Save the search results to a file.""" |
262 | 399 | dialog = Gtk.FileChooserDialog( | 433 | dialog = Gtk.FileChooserDialog( |
263 | 400 | 434 | ||
264 | === modified file 'plugins/gdp/find.ui' | |||
265 | --- plugins/gdp/find.ui 2012-03-12 13:04:13 +0000 | |||
266 | +++ plugins/gdp/find.ui 2012-06-18 13:32:54 +0000 | |||
267 | @@ -13,128 +13,24 @@ | |||
268 | 13 | <property name="orientation">vertical</property> | 13 | <property name="orientation">vertical</property> |
269 | 14 | <property name="spacing">2</property> | 14 | <property name="spacing">2</property> |
270 | 15 | <child> | 15 | <child> |
272 | 16 | <object class="GtkGrid" id="find_controls"> | 16 | <object class="GtkComboBoxText" id="path_comboentry"> |
273 | 17 | <property name="visible">True</property> | 17 | <property name="visible">True</property> |
274 | 18 | <property name="can_focus">False</property> | 18 | <property name="can_focus">False</property> |
394 | 19 | <property name="row_spacing">6</property> | 19 | <property name="has_tooltip">True</property> |
395 | 20 | <property name="column_spacing">6</property> | 20 | <property name="tooltip_markup" translatable="yes">The directory to start searching in.</property> |
396 | 21 | <child> | 21 | <property name="tooltip_text" translatable="yes">The directory to start searching in.</property> |
397 | 22 | <object class="GtkLabel" id="path_label"> | 22 | <property name="hexpand">True</property> |
398 | 23 | <property name="visible">True</property> | 23 | <property name="has_entry">True</property> |
399 | 24 | <property name="can_focus">False</property> | 24 | <child internal-child="entry"> |
400 | 25 | <property name="xalign">0</property> | 25 | <object class="GtkEntry" id="comboboxtext-entry4"> |
401 | 26 | <property name="ypad">5</property> | 26 | <property name="can_focus">True</property> |
402 | 27 | <property name="label" translatable="yes">Look in: </property> | 27 | <property name="invisible_char">•</property> |
403 | 28 | </object> | 28 | <property name="primary_icon_stock">gtk-directory</property> |
404 | 29 | <packing> | 29 | <property name="secondary_icon_activatable">False</property> |
405 | 30 | <property name="left_attach">0</property> | 30 | <property name="secondary_icon_sensitive">False</property> |
406 | 31 | <property name="top_attach">0</property> | 31 | <signal name="activate" handler="on_find_in_files" swapped="no"/> |
407 | 32 | <property name="width">1</property> | 32 | <signal name="icon-press" handler="on_choose_directory_icon_press" swapped="no"/> |
408 | 33 | <property name="height">1</property> | 33 | </object> |
290 | 34 | </packing> | ||
291 | 35 | </child> | ||
292 | 36 | <child> | ||
293 | 37 | <object class="GtkLabel" id="match_label"> | ||
294 | 38 | <property name="visible">True</property> | ||
295 | 39 | <property name="can_focus">False</property> | ||
296 | 40 | <property name="label" translatable="yes">Search for:</property> | ||
297 | 41 | </object> | ||
298 | 42 | <packing> | ||
299 | 43 | <property name="left_attach">0</property> | ||
300 | 44 | <property name="top_attach">1</property> | ||
301 | 45 | <property name="width">1</property> | ||
302 | 46 | <property name="height">1</property> | ||
303 | 47 | </packing> | ||
304 | 48 | </child> | ||
305 | 49 | <child> | ||
306 | 50 | <object class="GtkBox" id="hbox1"> | ||
307 | 51 | <property name="visible">True</property> | ||
308 | 52 | <property name="can_focus">False</property> | ||
309 | 53 | <property name="spacing">6</property> | ||
310 | 54 | <child> | ||
311 | 55 | <object class="GtkComboBoxText" id="pattern_comboentry"> | ||
312 | 56 | <property name="visible">True</property> | ||
313 | 57 | <property name="can_focus">False</property> | ||
314 | 58 | <property name="has_tooltip">True</property> | ||
315 | 59 | <property name="tooltip_markup" translatable="yes">The plain text or Python regular expression to find in files.</property> | ||
316 | 60 | <property name="tooltip_text" translatable="yes">The plain text or Python regular expression to find in files.</property> | ||
317 | 61 | <property name="has_entry">True</property> | ||
318 | 62 | <child internal-child="entry"> | ||
319 | 63 | <object class="GtkEntry" id="comboboxtext-entry3"> | ||
320 | 64 | <property name="can_focus">True</property> | ||
321 | 65 | <property name="invisible_char">•</property> | ||
322 | 66 | <signal name="activate" handler="on_find_in_files" swapped="no"/> | ||
323 | 67 | </object> | ||
324 | 68 | </child> | ||
325 | 69 | </object> | ||
326 | 70 | <packing> | ||
327 | 71 | <property name="expand">True</property> | ||
328 | 72 | <property name="fill">True</property> | ||
329 | 73 | <property name="position">0</property> | ||
330 | 74 | </packing> | ||
331 | 75 | </child> | ||
332 | 76 | <child> | ||
333 | 77 | <object class="GtkButton" id="find_in_files_button"> | ||
334 | 78 | <property name="label" translatable="yes"> Find </property> | ||
335 | 79 | <property name="use_action_appearance">False</property> | ||
336 | 80 | <property name="visible">True</property> | ||
337 | 81 | <property name="can_focus">True</property> | ||
338 | 82 | <property name="receives_default">True</property> | ||
339 | 83 | <property name="use_action_appearance">False</property> | ||
340 | 84 | <signal name="clicked" handler="on_find_in_files" swapped="no"/> | ||
341 | 85 | </object> | ||
342 | 86 | <packing> | ||
343 | 87 | <property name="expand">False</property> | ||
344 | 88 | <property name="fill">True</property> | ||
345 | 89 | <property name="position">1</property> | ||
346 | 90 | </packing> | ||
347 | 91 | </child> | ||
348 | 92 | </object> | ||
349 | 93 | <packing> | ||
350 | 94 | <property name="left_attach">1</property> | ||
351 | 95 | <property name="top_attach">1</property> | ||
352 | 96 | <property name="width">1</property> | ||
353 | 97 | <property name="height">1</property> | ||
354 | 98 | </packing> | ||
355 | 99 | </child> | ||
356 | 100 | <child> | ||
357 | 101 | <object class="GtkComboBoxText" id="path_comboentry"> | ||
358 | 102 | <property name="visible">True</property> | ||
359 | 103 | <property name="can_focus">False</property> | ||
360 | 104 | <property name="has_tooltip">True</property> | ||
361 | 105 | <property name="tooltip_markup" translatable="yes">The directory to start searching in.</property> | ||
362 | 106 | <property name="tooltip_text" translatable="yes">The directory to start searching in.</property> | ||
363 | 107 | <property name="hexpand">True</property> | ||
364 | 108 | <property name="has_entry">True</property> | ||
365 | 109 | <child internal-child="entry"> | ||
366 | 110 | <object class="GtkEntry" id="comboboxtext-entry4"> | ||
367 | 111 | <property name="can_focus">True</property> | ||
368 | 112 | <property name="invisible_char">•</property> | ||
369 | 113 | <signal name="activate" handler="on_find_in_files" swapped="no"/> | ||
370 | 114 | </object> | ||
371 | 115 | </child> | ||
372 | 116 | </object> | ||
373 | 117 | <packing> | ||
374 | 118 | <property name="left_attach">1</property> | ||
375 | 119 | <property name="top_attach">0</property> | ||
376 | 120 | <property name="width">1</property> | ||
377 | 121 | <property name="height">1</property> | ||
378 | 122 | </packing> | ||
379 | 123 | </child> | ||
380 | 124 | <child> | ||
381 | 125 | <placeholder/> | ||
382 | 126 | </child> | ||
383 | 127 | <child> | ||
384 | 128 | <placeholder/> | ||
385 | 129 | </child> | ||
386 | 130 | <child> | ||
387 | 131 | <placeholder/> | ||
388 | 132 | </child> | ||
389 | 133 | <child> | ||
390 | 134 | <placeholder/> | ||
391 | 135 | </child> | ||
392 | 136 | <child> | ||
393 | 137 | <placeholder/> | ||
409 | 138 | </child> | 34 | </child> |
410 | 139 | </object> | 35 | </object> |
411 | 140 | <packing> | 36 | <packing> |
412 | @@ -144,6 +40,35 @@ | |||
413 | 144 | </packing> | 40 | </packing> |
414 | 145 | </child> | 41 | </child> |
415 | 146 | <child> | 42 | <child> |
416 | 43 | <object class="GtkComboBoxText" id="pattern_comboentry"> | ||
417 | 44 | <property name="visible">True</property> | ||
418 | 45 | <property name="can_focus">False</property> | ||
419 | 46 | <property name="has_tooltip">True</property> | ||
420 | 47 | <property name="tooltip_markup" translatable="yes">The plain text or Python regular expression to find in files.</property> | ||
421 | 48 | <property name="tooltip_text" translatable="yes">The plain text or Python regular expression to find in files.</property> | ||
422 | 49 | <property name="has_entry">True</property> | ||
423 | 50 | <property name="entry_text_column">0</property> | ||
424 | 51 | <property name="id_column">1</property> | ||
425 | 52 | <child internal-child="entry"> | ||
426 | 53 | <object class="GtkEntry" id="comboboxtext-entry"> | ||
427 | 54 | <property name="can_focus">True</property> | ||
428 | 55 | <property name="invisible_char">•</property> | ||
429 | 56 | <property name="primary_icon_stock">gtk-find</property> | ||
430 | 57 | <property name="secondary_icon_stock">gtk-refresh</property> | ||
431 | 58 | <property name="primary_icon_activatable">False</property> | ||
432 | 59 | <property name="placeholder_text">Matching text</property> | ||
433 | 60 | <signal name="activate" handler="on_find_in_files" swapped="no"/> | ||
434 | 61 | <signal name="icon-press" handler="on_find_in_files_icon_press" swapped="no"/> | ||
435 | 62 | </object> | ||
436 | 63 | </child> | ||
437 | 64 | </object> | ||
438 | 65 | <packing> | ||
439 | 66 | <property name="expand">False</property> | ||
440 | 67 | <property name="fill">True</property> | ||
441 | 68 | <property name="position">1</property> | ||
442 | 69 | </packing> | ||
443 | 70 | </child> | ||
444 | 71 | <child> | ||
445 | 147 | <object class="GtkExpander" id="options"> | 72 | <object class="GtkExpander" id="options"> |
446 | 148 | <property name="visible">True</property> | 73 | <property name="visible">True</property> |
447 | 149 | <property name="can_focus">True</property> | 74 | <property name="can_focus">True</property> |
448 | @@ -193,42 +118,22 @@ | |||
449 | 193 | </packing> | 118 | </packing> |
450 | 194 | </child> | 119 | </child> |
451 | 195 | <child> | 120 | <child> |
453 | 196 | <object class="GtkBox" id="hbox4"> | 121 | <object class="GtkComboBoxText" id="file_comboentry"> |
454 | 197 | <property name="visible">True</property> | 122 | <property name="visible">True</property> |
455 | 198 | <property name="can_focus">False</property> | 123 | <property name="can_focus">False</property> |
478 | 199 | <property name="spacing">6</property> | 124 | <property name="has_entry">True</property> |
479 | 200 | <child> | 125 | <child internal-child="entry"> |
480 | 201 | <object class="GtkLabel" id="file_name_label"> | 126 | <object class="GtkEntry" id="comboboxtext-entry25"> |
481 | 202 | <property name="visible">True</property> | 127 | <property name="can_focus">True</property> |
482 | 203 | <property name="can_focus">False</property> | 128 | <property name="tooltip_text" translatable="yes">A regular expression pattern used to match the directory or file name. |
461 | 204 | <property name="label" translatable="yes">File name pattern:</property> | ||
462 | 205 | </object> | ||
463 | 206 | <packing> | ||
464 | 207 | <property name="expand">False</property> | ||
465 | 208 | <property name="fill">True</property> | ||
466 | 209 | <property name="position">0</property> | ||
467 | 210 | </packing> | ||
468 | 211 | </child> | ||
469 | 212 | <child> | ||
470 | 213 | <object class="GtkComboBoxText" id="file_comboentry"> | ||
471 | 214 | <property name="visible">True</property> | ||
472 | 215 | <property name="can_focus">False</property> | ||
473 | 216 | <property name="has_entry">True</property> | ||
474 | 217 | <child internal-child="entry"> | ||
475 | 218 | <object class="GtkEntry" id="comboboxtext-entry25"> | ||
476 | 219 | <property name="can_focus">True</property> | ||
477 | 220 | <property name="tooltip_text" translatable="yes">A regular expression pattern used to match the directory or file name. | ||
483 | 221 | eg. py or tests/ or \.(py|html)$</property> | 129 | eg. py or tests/ or \.(py|html)$</property> |
488 | 222 | <property name="invisible_char">•</property> | 130 | <property name="invisible_char">•</property> |
489 | 223 | <signal name="activate" handler="on_find_in_files" swapped="no"/> | 131 | <property name="primary_icon_stock">gtk-file</property> |
490 | 224 | </object> | 132 | <property name="secondary_icon_activatable">False</property> |
491 | 225 | </child> | 133 | <property name="secondary_icon_sensitive">False</property> |
492 | 134 | <property name="placeholder_text">File name pattern</property> | ||
493 | 135 | <signal name="activate" handler="on_find_in_files" swapped="no"/> | ||
494 | 226 | </object> | 136 | </object> |
495 | 227 | <packing> | ||
496 | 228 | <property name="expand">True</property> | ||
497 | 229 | <property name="fill">True</property> | ||
498 | 230 | <property name="position">1</property> | ||
499 | 231 | </packing> | ||
500 | 232 | </child> | 137 | </child> |
501 | 233 | </object> | 138 | </object> |
502 | 234 | <packing> | 139 | <packing> |
503 | @@ -250,7 +155,7 @@ | |||
504 | 250 | <packing> | 155 | <packing> |
505 | 251 | <property name="expand">False</property> | 156 | <property name="expand">False</property> |
506 | 252 | <property name="fill">True</property> | 157 | <property name="fill">True</property> |
508 | 253 | <property name="position">1</property> | 158 | <property name="position">2</property> |
509 | 254 | </packing> | 159 | </packing> |
510 | 255 | </child> | 160 | </child> |
511 | 256 | <child> | 161 | <child> |
512 | @@ -274,7 +179,7 @@ | |||
513 | 274 | <packing> | 179 | <packing> |
514 | 275 | <property name="expand">True</property> | 180 | <property name="expand">True</property> |
515 | 276 | <property name="fill">True</property> | 181 | <property name="fill">True</property> |
517 | 277 | <property name="position">2</property> | 182 | <property name="position">3</property> |
518 | 278 | </packing> | 183 | </packing> |
519 | 279 | </child> | 184 | </child> |
520 | 280 | <child> | 185 | <child> |
521 | @@ -288,64 +193,26 @@ | |||
522 | 288 | <property name="orientation">vertical</property> | 193 | <property name="orientation">vertical</property> |
523 | 289 | <property name="spacing">6</property> | 194 | <property name="spacing">6</property> |
524 | 290 | <child> | 195 | <child> |
526 | 291 | <object class="GtkBox" id="hbox5"> | 196 | <object class="GtkComboBoxText" id="substitution_comboentry"> |
527 | 292 | <property name="visible">True</property> | 197 | <property name="visible">True</property> |
528 | 293 | <property name="can_focus">False</property> | 198 | <property name="can_focus">False</property> |
570 | 294 | <property name="spacing">6</property> | 199 | <property name="has_tooltip">True</property> |
571 | 295 | <child> | 200 | <property name="tooltip_markup" translatable="yes">The text to replace each found match with. |
572 | 296 | <object class="GtkLabel" id="label2"> | 201 | The replacement may use backslash escapes to access groups in match expression</property> |
573 | 297 | <property name="visible">True</property> | 202 | <property name="tooltip_text" translatable="yes">The text to replace each found match with. |
574 | 298 | <property name="can_focus">False</property> | 203 | The replacement may use backslash escapes to access groups in match expression</property> |
575 | 299 | <property name="label" translatable="yes">Replace with:</property> | 204 | <property name="has_entry">True</property> |
576 | 300 | </object> | 205 | <child internal-child="entry"> |
577 | 301 | <packing> | 206 | <object class="GtkEntry" id="comboboxtext-entry23"> |
537 | 302 | <property name="expand">False</property> | ||
538 | 303 | <property name="fill">False</property> | ||
539 | 304 | <property name="position">0</property> | ||
540 | 305 | </packing> | ||
541 | 306 | </child> | ||
542 | 307 | <child> | ||
543 | 308 | <object class="GtkComboBoxText" id="substitution_comboentry"> | ||
544 | 309 | <property name="visible">True</property> | ||
545 | 310 | <property name="can_focus">False</property> | ||
546 | 311 | <property name="has_tooltip">True</property> | ||
547 | 312 | <property name="tooltip_markup" translatable="yes">The text to replace each found match with. | ||
548 | 313 | The replacement may use backslash escapes to access groups in match expression</property> | ||
549 | 314 | <property name="tooltip_text" translatable="yes">The text to replace each found match with. | ||
550 | 315 | The replacement may use backslash escapes to access groups in match expression</property> | ||
551 | 316 | <property name="has_entry">True</property> | ||
552 | 317 | <child internal-child="entry"> | ||
553 | 318 | <object class="GtkEntry" id="comboboxtext-entry23"> | ||
554 | 319 | <property name="can_focus">True</property> | ||
555 | 320 | <property name="invisible_char">•</property> | ||
556 | 321 | </object> | ||
557 | 322 | </child> | ||
558 | 323 | </object> | ||
559 | 324 | <packing> | ||
560 | 325 | <property name="expand">True</property> | ||
561 | 326 | <property name="fill">True</property> | ||
562 | 327 | <property name="position">1</property> | ||
563 | 328 | </packing> | ||
564 | 329 | </child> | ||
565 | 330 | <child> | ||
566 | 331 | <object class="GtkButton" id="replace_in_files_button"> | ||
567 | 332 | <property name="label" translatable="yes">Replace</property> | ||
568 | 333 | <property name="use_action_appearance">False</property> | ||
569 | 334 | <property name="visible">True</property> | ||
578 | 335 | <property name="can_focus">True</property> | 207 | <property name="can_focus">True</property> |
585 | 336 | <property name="receives_default">True</property> | 208 | <property name="invisible_char">•</property> |
586 | 337 | <property name="has_tooltip">True</property> | 209 | <property name="primary_icon_stock">gtk-find-and-replace</property> |
587 | 338 | <property name="tooltip_markup" translatable="yes">Replace the matched text.</property> | 210 | <property name="secondary_icon_stock">gtk-refresh</property> |
588 | 339 | <property name="tooltip_text" translatable="yes">Replace the matched text.</property> | 211 | <property name="primary_icon_activatable">False</property> |
589 | 340 | <property name="use_action_appearance">False</property> | 212 | <property name="placeholder_text">Replacement text</property> |
590 | 341 | <signal name="clicked" handler="on_replace_in_files" swapped="no"/> | 213 | <signal name="activate" handler="on_replace_in_files" swapped="no"/> |
591 | 214 | <signal name="icon-press" handler="on_replace_in_files_icon_press" swapped="no"/> | ||
592 | 342 | </object> | 215 | </object> |
593 | 343 | <packing> | ||
594 | 344 | <property name="expand">False</property> | ||
595 | 345 | <property name="fill">False</property> | ||
596 | 346 | <property name="pack_type">end</property> | ||
597 | 347 | <property name="position">2</property> | ||
598 | 348 | </packing> | ||
599 | 349 | </child> | 216 | </child> |
600 | 350 | </object> | 217 | </object> |
601 | 351 | <packing> | 218 | <packing> |
602 | @@ -400,7 +267,7 @@ | |||
603 | 400 | <property name="expand">False</property> | 267 | <property name="expand">False</property> |
604 | 401 | <property name="fill">True</property> | 268 | <property name="fill">True</property> |
605 | 402 | <property name="padding">6</property> | 269 | <property name="padding">6</property> |
607 | 403 | <property name="position">3</property> | 270 | <property name="position">4</property> |
608 | 404 | </packing> | 271 | </packing> |
609 | 405 | </child> | 272 | </child> |
610 | 406 | </object> | 273 | </object> |
611 | 407 | 274 | ||
612 | === modified file 'plugins/gdp/tests/test_find.py' | |||
613 | --- plugins/gdp/tests/test_find.py 2012-03-12 13:04:13 +0000 | |||
614 | +++ plugins/gdp/tests/test_find.py 2012-06-18 13:32:54 +0000 | |||
615 | @@ -13,7 +13,10 @@ | |||
616 | 13 | Finder, | 13 | Finder, |
617 | 14 | FinderWorker, | 14 | FinderWorker, |
618 | 15 | ) | 15 | ) |
620 | 16 | from testing import GeditTestCase | 16 | from testing import ( |
621 | 17 | GeditTestCase, | ||
622 | 18 | MockMethod, | ||
623 | 19 | ) | ||
624 | 17 | 20 | ||
625 | 18 | 21 | ||
626 | 19 | class TestCallback: | 22 | class TestCallback: |
627 | @@ -182,6 +185,39 @@ | |||
628 | 182 | self.assertEqual(['one', 'three', 'two'], words) | 185 | self.assertEqual(['one', 'three', 'two'], words) |
629 | 183 | self.assertEqual('two', comboentry.get_active_text()) | 186 | self.assertEqual('two', comboentry.get_active_text()) |
630 | 184 | 187 | ||
631 | 188 | def test_path(self): | ||
632 | 189 | self.make_config(find, Config) | ||
633 | 190 | window, view, document = self.make_gedit( | ||
634 | 191 | 'plugins/gdp/data/snark12.txt') | ||
635 | 192 | finder = Finder(window) | ||
636 | 193 | finder.update_comboentry( | ||
637 | 194 | finder.path_comboentry, '/fnord/pting', True) | ||
638 | 195 | self.assertEqual('/fnord/pting', finder.path) | ||
639 | 196 | finder.update_comboentry( | ||
640 | 197 | finder.path_comboentry, '<Working Directory>', True) | ||
641 | 198 | self.assertEqual('.', finder.path) | ||
642 | 199 | finder.update_comboentry( | ||
643 | 200 | finder.path_comboentry, '<Current File>', True) | ||
644 | 201 | self.assertIs(False, finder.path.startswith('file://')) | ||
645 | 202 | self.assertIs(True, finder.path.endswith('plugins/gdp/data')) | ||
646 | 203 | |||
647 | 204 | def test_file_pattern(self): | ||
648 | 205 | self.make_config(find, Config) | ||
649 | 206 | window, view, document = self.make_gedit( | ||
650 | 207 | 'plugins/gdp/data/snark12.txt') | ||
651 | 208 | finder = Finder(window) | ||
652 | 209 | finder.update_comboentry( | ||
653 | 210 | finder.file_comboentry, 'txt', True) | ||
654 | 211 | self.assertEqual('txt', finder.file_pattern) | ||
655 | 212 | finder.update_comboentry( | ||
656 | 213 | finder.file_comboentry, '<Any Text File>', True) | ||
657 | 214 | self.assertEqual('.', finder.file_pattern) | ||
658 | 215 | finder.update_comboentry( | ||
659 | 216 | finder.path_comboentry, '<Current File>', True) | ||
660 | 217 | finder.update_comboentry( | ||
661 | 218 | finder.file_comboentry, 'ignored', True) | ||
662 | 219 | self.assertEqual('snark12.txt', finder.file_pattern) | ||
663 | 220 | |||
664 | 185 | def test_save_find_data(self): | 221 | def test_save_find_data(self): |
665 | 186 | # Setup a test config so that the singleton is not mutated. | 222 | # Setup a test config so that the singleton is not mutated. |
666 | 187 | file_ = self.make_config(find, Config) | 223 | file_ = self.make_config(find, Config) |
667 | @@ -210,6 +246,23 @@ | |||
668 | 210 | self.assertIn('matches = eleven\n', config_data) | 246 | self.assertIn('matches = eleven\n', config_data) |
669 | 211 | self.assertNotIn('\t.\n', config_data) | 247 | self.assertNotIn('\t.\n', config_data) |
670 | 212 | 248 | ||
671 | 249 | def test_on_choose_directory_icon_press(self): | ||
672 | 250 | # Setup a test config so that the singleton is not mutated. | ||
673 | 251 | self.make_config(find, Config) | ||
674 | 252 | window, view, document = self.make_gedit( | ||
675 | 253 | 'plugins/gdp/data/snark12.txt') | ||
676 | 254 | finder = Finder(window) | ||
677 | 255 | expected_path = os.path.abspath('plugins/gdp/data/snark12.txt') | ||
678 | 256 | MockMethod.bind( | ||
679 | 257 | self, Gtk.FileChooserDialog, 'run', Gtk.ResponseType.ACCEPT) | ||
680 | 258 | MockMethod.bind( | ||
681 | 259 | self, Gtk.FileChooserDialog, 'get_filename', expected_path) | ||
682 | 260 | finder.on_choose_directory_icon_press( | ||
683 | 261 | finder.path_comboentry, Gtk.EntryIconPosition.SECONDARY, None) | ||
684 | 262 | self.assertIs(True, Gtk.FileChooserDialog.run.called) | ||
685 | 263 | self.assertEqual( | ||
686 | 264 | expected_path, finder.path_comboentry.get_active_text()) | ||
687 | 265 | |||
688 | 213 | def test_on_find_in_files(self): | 266 | def test_on_find_in_files(self): |
689 | 214 | # Setup a test config so that the singleton is not mutated. | 267 | # Setup a test config so that the singleton is not mutated. |
690 | 215 | file_ = self.make_config(find, Config) | 268 | file_ = self.make_config(find, Config) |
691 | @@ -226,6 +279,37 @@ | |||
692 | 226 | finder.file_lines_view.get_column(0).props.title) | 279 | finder.file_lines_view.get_column(0).props.title) |
693 | 227 | self.assertIn('matches = snark\n', file_.read()) | 280 | self.assertIn('matches = snark\n', file_.read()) |
694 | 228 | 281 | ||
695 | 282 | def test_on_find_in_files_icon_press(self): | ||
696 | 283 | # Setup a test config so that the singleton is not mutated. | ||
697 | 284 | self.make_config(find, Config) | ||
698 | 285 | window, view, document = self.make_gedit( | ||
699 | 286 | 'plugins/gdp/data/snark12.txt') | ||
700 | 287 | finder = Finder(window) | ||
701 | 288 | finder.update_comboentry(finder.pattern_comboentry, 'snark', True) | ||
702 | 289 | finder.update_comboentry( | ||
703 | 290 | finder.path_comboentry, '<Current File>', True) | ||
704 | 291 | MockMethod.bind(self, finder, 'on_find_in_files') | ||
705 | 292 | finder.on_find_in_files_icon_press( | ||
706 | 293 | finder.pattern_comboentry, Gtk.EntryIconPosition.SECONDARY, None) | ||
707 | 294 | self.assertTrue(finder.on_find_in_files.called) | ||
708 | 295 | |||
709 | 296 | def test_on_find_in_files_nonexistant_path(self): | ||
710 | 297 | # Setup a test config so that the singleton is not mutated. | ||
711 | 298 | self.make_config(find, Config) | ||
712 | 299 | window, view, document = self.make_gedit( | ||
713 | 300 | 'plugins/gdp/data/snark12.txt') | ||
714 | 301 | finder = Finder(window) | ||
715 | 302 | finder.update_comboentry(finder.pattern_comboentry, 'snark', True) | ||
716 | 303 | finder.update_comboentry( | ||
717 | 304 | finder.path_comboentry, '/fnord/pting/snarf', True) | ||
718 | 305 | MockMethod.bind(self, find, 'FinderWorker') | ||
719 | 306 | finder.on_find_in_files() | ||
720 | 307 | self.assertIs(False, find.FinderWorker.called) | ||
721 | 308 | self.assertIs(None, finder.last_find) | ||
722 | 309 | self.assertEqual( | ||
723 | 310 | 'The directory path does not exist!', | ||
724 | 311 | finder.file_lines_view.get_model()[0][0]) | ||
725 | 312 | |||
726 | 229 | def test_show_replace(self): | 313 | def test_show_replace(self): |
727 | 230 | window, view, document = self.make_gedit( | 314 | window, view, document = self.make_gedit( |
728 | 231 | 'plugins/gdp/data/snark12.txt') | 315 | 'plugins/gdp/data/snark12.txt') |
729 | @@ -235,6 +319,21 @@ | |||
730 | 235 | finder.show_replace(None) | 319 | finder.show_replace(None) |
731 | 236 | self.assertTrue(panel.props.visible) | 320 | self.assertTrue(panel.props.visible) |
732 | 237 | 321 | ||
733 | 322 | def test_on_replace_in_files_icon_press(self): | ||
734 | 323 | # Setup a test config so that the singleton is not mutated. | ||
735 | 324 | self.make_config(find, Config) | ||
736 | 325 | window, view, document = self.make_gedit( | ||
737 | 326 | 'plugins/gdp/data/snark12.txt') | ||
738 | 327 | finder = Finder(window) | ||
739 | 328 | finder.update_comboentry(finder.pattern_comboentry, 'snark', True) | ||
740 | 329 | finder.update_comboentry( | ||
741 | 330 | finder.path_comboentry, '<Current File>', True) | ||
742 | 331 | MockMethod.bind(self, finder, 'on_replace_in_files') | ||
743 | 332 | finder.on_replace_in_files_icon_press( | ||
744 | 333 | finder.substitution_comboentry, | ||
745 | 334 | Gtk.EntryIconPosition.SECONDARY, None) | ||
746 | 335 | self.assertTrue(finder.on_replace_in_files.called) | ||
747 | 336 | |||
748 | 238 | def test_get_untested_replacement_dialog(self): | 337 | def test_get_untested_replacement_dialog(self): |
749 | 239 | # If the plugin's last_find is not equal to the current find, | 338 | # If the plugin's last_find is not equal to the current find, |
750 | 240 | # a window is presented to confirm the replace. | 339 | # a window is presented to confirm the replace. |
751 | 241 | 340 | ||
752 | === modified file 'plugins/gdp/tests/test_gdp.py' | |||
753 | --- plugins/gdp/tests/test_gdp.py 2012-02-07 12:20:48 +0000 | |||
754 | +++ plugins/gdp/tests/test_gdp.py 2012-06-18 13:32:54 +0000 | |||
755 | @@ -6,12 +6,74 @@ | |||
756 | 6 | 6 | ||
757 | 7 | from xdg import BaseDirectory | 7 | from xdg import BaseDirectory |
758 | 8 | 8 | ||
759 | 9 | from gi.repository import ( | ||
760 | 10 | GObject, | ||
761 | 11 | Gtk, | ||
762 | 12 | ) | ||
763 | 13 | |||
764 | 9 | from gdp import ( | 14 | from gdp import ( |
765 | 10 | Config, | 15 | Config, |
766 | 16 | set_file_line, | ||
767 | 11 | ) | 17 | ) |
768 | 12 | from testing import GeditTestCase | 18 | from testing import GeditTestCase |
769 | 13 | 19 | ||
770 | 14 | 20 | ||
771 | 21 | class FileLinesViewTestCase(GeditTestCase): | ||
772 | 22 | |||
773 | 23 | def makeTreeStore(self): | ||
774 | 24 | return Gtk.TreeStore( | ||
775 | 25 | GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_INT, | ||
776 | 26 | GObject.TYPE_STRING, GObject.TYPE_STRING) | ||
777 | 27 | |||
778 | 28 | def test_set_file_type_line_no_and_message(self): | ||
779 | 29 | model = self.makeTreeStore() | ||
780 | 30 | piter = model.append( | ||
781 | 31 | None, ('/fnord/pting', 'some-icon', 5, 'message', '/fnord')) | ||
782 | 32 | cell = Gtk.CellRendererText() | ||
783 | 33 | set_file_line(None, cell, model, piter, 'line_no') | ||
784 | 34 | self.assertEqual('5', cell.props.text) | ||
785 | 35 | |||
786 | 36 | def test_set_file_type_line_no_without_message(self): | ||
787 | 37 | model = self.makeTreeStore() | ||
788 | 38 | piter = model.append( | ||
789 | 39 | None, ('/fnord/pting', 'some-icon', 5, None, '/fnord')) | ||
790 | 40 | cell = Gtk.CellRendererText() | ||
791 | 41 | set_file_line(None, cell, model, piter, 'line_no') | ||
792 | 42 | self.assertEqual('', cell.props.text) | ||
793 | 43 | |||
794 | 44 | def test_set_file_type_text_and_message(self): | ||
795 | 45 | model = self.makeTreeStore() | ||
796 | 46 | piter = model.append( | ||
797 | 47 | None, ('/fnord/pting', 'some-icon', 5, 'message', '/fnord')) | ||
798 | 48 | cell = Gtk.CellRendererText() | ||
799 | 49 | set_file_line(None, cell, model, piter, 'text') | ||
800 | 50 | self.assertEqual('message', cell.props.text) | ||
801 | 51 | |||
802 | 52 | def test_set_file_type_text_without_message(self): | ||
803 | 53 | model = self.makeTreeStore() | ||
804 | 54 | piter = model.append( | ||
805 | 55 | None, ('/fnord/pting', 'some-icon', 5, None, '/fnord')) | ||
806 | 56 | cell = Gtk.CellRendererText() | ||
807 | 57 | set_file_line(None, cell, model, piter, 'text') | ||
808 | 58 | self.assertEqual('./pting', cell.props.text) | ||
809 | 59 | |||
810 | 60 | def test_set_file_type_text_without_message_with_trailing_slash(self): | ||
811 | 61 | model = self.makeTreeStore() | ||
812 | 62 | piter = model.append( | ||
813 | 63 | None, ('/fnord/pting', 'some-icon', 5, None, '/fnord/')) | ||
814 | 64 | cell = Gtk.CellRendererText() | ||
815 | 65 | set_file_line(None, cell, model, piter, 'text') | ||
816 | 66 | self.assertEqual('./pting', cell.props.text) | ||
817 | 67 | |||
818 | 68 | def test_set_file_type_text_without_message_or_base_dir(self): | ||
819 | 69 | model = self.makeTreeStore() | ||
820 | 70 | piter = model.append( | ||
821 | 71 | None, ('/fnord/pting', 'some-icon', 5, None, None)) | ||
822 | 72 | cell = Gtk.CellRendererText() | ||
823 | 73 | set_file_line(None, cell, model, piter, 'text') | ||
824 | 74 | self.assertEqual('/fnord/pting', cell.props.text) | ||
825 | 75 | |||
826 | 76 | |||
827 | 15 | class ConfigTestCase(GeditTestCase): | 77 | class ConfigTestCase(GeditTestCase): |
828 | 16 | 78 | ||
829 | 17 | def make_config(self, text=''): | 79 | def make_config(self, text=''): |
830 | 18 | 80 | ||
831 | === modified file 'testing/__init__.py' | |||
832 | --- testing/__init__.py 2012-03-12 13:04:13 +0000 | |||
833 | +++ testing/__init__.py 2012-06-18 13:32:54 +0000 | |||
834 | @@ -50,8 +50,8 @@ | |||
835 | 50 | self.addCleanup( | 50 | self.addCleanup( |
836 | 51 | os.environ.update, {'GSETTINGS_BACKEND': old_backend}) | 51 | os.environ.update, {'GSETTINGS_BACKEND': old_backend}) |
837 | 52 | else: | 52 | else: |
838 | 53 | os.environ['GSETTINGS_BACKEND'] = 'memory' | ||
839 | 54 | self.addCleanup(os.environ.__delitem__, 'GSETTINGS_BACKEND') | 53 | self.addCleanup(os.environ.__delitem__, 'GSETTINGS_BACKEND') |
840 | 54 | os.environ['GSETTINGS_BACKEND'] = 'memory' | ||
841 | 55 | settings = Gio.Settings.new('org.gnome.gedit.plugins') | 55 | settings = Gio.Settings.new('org.gnome.gedit.plugins') |
842 | 56 | return settings | 56 | return settings |
843 | 57 | 57 | ||
844 | @@ -74,7 +74,7 @@ | |||
845 | 74 | return text_file | 74 | return text_file |
846 | 75 | 75 | ||
847 | 76 | 76 | ||
849 | 77 | class MockMethod: | 77 | class MockMethod(object): |
850 | 78 | 78 | ||
851 | 79 | @classmethod | 79 | @classmethod |
852 | 80 | def bind(klass, test_instance, obj, method_name, | 80 | def bind(klass, test_instance, obj, method_name, |
853 | 81 | 81 | ||
854 | === modified file 'testing/testrunner.py' | |||
855 | --- testing/testrunner.py 2012-03-12 13:04:13 +0000 | |||
856 | +++ testing/testrunner.py 2012-06-18 13:32:54 +0000 | |||
857 | @@ -196,6 +196,7 @@ | |||
858 | 196 | setup_env(params) | 196 | setup_env(params) |
859 | 197 | os.chdir(project_dir()) | 197 | os.chdir(project_dir()) |
860 | 198 | os.environ['use_fake_gedit'] = 'true' | 198 | os.environ['use_fake_gedit'] = 'true' |
861 | 199 | os.environ['GSETTINGS_BACKEND'] = 'memory' | ||
862 | 199 | # Format the output. | 200 | # Format the output. |
863 | 200 | unittest.runner._WritelnDecorator = Env.write_decorator | 201 | unittest.runner._WritelnDecorator = Env.write_decorator |
864 | 201 | suite = unittest.TestSuite() | 202 | suite = unittest.TestSuite() |
Thanks! Merged with fixing LP: # syntax in debian/changelog.