Merge lp:~teemperor/pantheon-greeter/unittest-branch-truncating into lp:~elementary-pantheon/pantheon-greeter/trunk
- unittest-branch-truncating
- Merge into trunk
Proposed by
Cody Garver
Status: | Work in progress |
---|---|
Proposed branch: | lp:~teemperor/pantheon-greeter/unittest-branch-truncating |
Merge into: | lp:~elementary-pantheon/pantheon-greeter/trunk |
Diff against target: |
442 lines (+373/-0) (has conflicts) 6 files modified
CMakeLists.txt (+2/-0) src/LoginBox.vala (+255/-0) tests/CMakeLists.txt (+21/-0) tests/Main.vala (+8/-0) tests/NameTruncateTest.vala (+29/-0) tests/TestCase.vala (+58/-0) Text conflict in src/LoginBox.vala |
To merge this branch: | bzr merge lp:~teemperor/pantheon-greeter/unittest-branch-truncating |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cody Garver (community) | Needs Fixing | ||
Review via email: mp+213420@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Unmerged revisions
- 225. By Raphael Isemann
-
added test-template and fixed some bugs with the truncating
- 224. By Raphael Isemann
-
first version of name truncating
- 223. By Raphael Isemann
-
Fixing codestyle
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2013-10-08 18:27:22 +0000 | |||
3 | +++ CMakeLists.txt 2014-03-31 08:54:15 +0000 | |||
4 | @@ -57,6 +57,8 @@ | |||
5 | 57 | --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi | 57 | --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi |
6 | 58 | ) | 58 | ) |
7 | 59 | 59 | ||
8 | 60 | add_subdirectory (tests) | ||
9 | 61 | |||
10 | 60 | add_subdirectory (po) | 62 | add_subdirectory (po) |
11 | 61 | 63 | ||
12 | 62 | include (GSettings) | 64 | include (GSettings) |
13 | 63 | 65 | ||
14 | === modified file 'src/LoginBox.vala' | |||
15 | --- src/LoginBox.vala 2014-03-13 19:52:33 +0000 | |||
16 | +++ src/LoginBox.vala 2014-03-31 08:54:15 +0000 | |||
17 | @@ -22,6 +22,7 @@ | |||
18 | 22 | using Gtk; | 22 | using Gtk; |
19 | 23 | 23 | ||
20 | 24 | public class LoginBox : GtkClutter.Actor { | 24 | public class LoginBox : GtkClutter.Actor { |
21 | 25 | <<<<<<< TREE | ||
22 | 25 | public LoginOption user { get; private set; } | 26 | public LoginOption user { get; private set; } |
23 | 26 | public string current_session { | 27 | public string current_session { |
24 | 27 | get { | 28 | get { |
25 | @@ -66,9 +67,54 @@ | |||
26 | 66 | 67 | ||
27 | 67 | public LoginBox (LoginOption user) { | 68 | public LoginBox (LoginOption user) { |
28 | 68 | this.user = user; | 69 | this.user = user; |
29 | 70 | ======= | ||
30 | 71 | public LightDM.User current_user { get; private set; } | ||
31 | 72 | public string current_session { get; private set; } | ||
32 | 73 | |||
33 | 74 | static int username_maxlength = 16; | ||
34 | 75 | |||
35 | 76 | public Gtk.EventBox avatar; | ||
36 | 77 | public Gtk.Label username; | ||
37 | 78 | public Gtk.Entry password; | ||
38 | 79 | public Gtk.Button login; | ||
39 | 80 | public Gtk.ToggleButton settings; | ||
40 | 81 | Gtk.Grid grid; | ||
41 | 82 | Gtk.Spinner spinner; | ||
42 | 83 | Gdk.Pixbuf image; | ||
43 | 84 | |||
44 | 85 | Granite.Drawing.BufferSurface buffer; | ||
45 | 86 | int shadow_blur = 25; | ||
46 | 87 | int shadow_x = 0; | ||
47 | 88 | int shadow_y = 6; | ||
48 | 89 | double shadow_alpha = 0.6; | ||
49 | 90 | |||
50 | 91 | LightDM.Greeter greeter; | ||
51 | 92 | |||
52 | 93 | bool _working; | ||
53 | 94 | public bool working { | ||
54 | 95 | get { | ||
55 | 96 | return _working; | ||
56 | 97 | } set { | ||
57 | 98 | _working = value; | ||
58 | 99 | grid.remove ((_working)?avatar as Gtk.Widget:spinner as Gtk.Widget); | ||
59 | 100 | grid.attach ((_working)?spinner as Gtk.Widget:avatar as Gtk.Widget, 0, 0, 1, 3); | ||
60 | 101 | grid.show_all (); | ||
61 | 102 | spinner.start (); | ||
62 | 103 | if (LightDM.get_sessions ().length () == 1) | ||
63 | 104 | settings.hide (); | ||
64 | 105 | } | ||
65 | 106 | } | ||
66 | 107 | |||
67 | 108 | public Gtk.Window draw_ref; | ||
68 | 109 | |||
69 | 110 | public LoginBox (LightDM.Greeter greeter) { | ||
70 | 111 | this.greeter = greeter; | ||
71 | 112 | |||
72 | 113 | >>>>>>> MERGE-SOURCE | ||
73 | 69 | this.reactive = true; | 114 | this.reactive = true; |
74 | 70 | this.scale_gravity = Clutter.Gravity.CENTER; | 115 | this.scale_gravity = Clutter.Gravity.CENTER; |
75 | 71 | 116 | ||
76 | 117 | <<<<<<< TREE | ||
77 | 72 | 118 | ||
78 | 73 | if (user.is_guest ()) { | 119 | if (user.is_guest ()) { |
79 | 74 | credentials = new GuestLogin (user); | 120 | credentials = new GuestLogin (user); |
80 | @@ -105,6 +151,174 @@ | |||
81 | 105 | pass_focus (); | 151 | pass_focus (); |
82 | 106 | if (user.avatar_ready) { | 152 | if (user.avatar_ready) { |
83 | 107 | update_avatar (); | 153 | update_avatar (); |
84 | 154 | ======= | ||
85 | 155 | try { | ||
86 | 156 | this.image = Gtk.IconTheme.get_default ().load_icon ("avatar-default", 92, 0); | ||
87 | 157 | } catch (Error e) { | ||
88 | 158 | warning (e.message); | ||
89 | 159 | } | ||
90 | 160 | |||
91 | 161 | this.avatar = new Gtk.EventBox (); | ||
92 | 162 | this.username = new Gtk.Label (""); | ||
93 | 163 | this.password = new Gtk.Entry (); | ||
94 | 164 | this.login = new Gtk.Button.with_label (_("Login")); | ||
95 | 165 | this.settings = new Gtk.ToggleButton (); | ||
96 | 166 | |||
97 | 167 | avatar.set_size_request (92, 92); | ||
98 | 168 | avatar.valign = Gtk.Align.START; | ||
99 | 169 | avatar.visible_window = false; | ||
100 | 170 | username.hexpand = true; | ||
101 | 171 | username.halign = Gtk.Align.START; | ||
102 | 172 | username.ellipsize = Pango.EllipsizeMode.END; | ||
103 | 173 | username.margin_top = 6; | ||
104 | 174 | username.height_request = 1; | ||
105 | 175 | login.expand = false; | ||
106 | 176 | login.height_request = 1; | ||
107 | 177 | login.width_request = 120; | ||
108 | 178 | login.margin_top = 26; | ||
109 | 179 | login.halign = Gtk.Align.END; | ||
110 | 180 | settings.valign = Gtk.Align.START; | ||
111 | 181 | settings.relief = Gtk.ReliefStyle.NONE; | ||
112 | 182 | settings.add (new Gtk.Image.from_icon_name ("application-menu-symbolic", Gtk.IconSize.MENU)); | ||
113 | 183 | password.margin_top = 11; | ||
114 | 184 | password.caps_lock_warning = true; | ||
115 | 185 | password.set_visibility (false); | ||
116 | 186 | password.key_release_event.connect ((e) => { | ||
117 | 187 | if (e.keyval == Gdk.Key.Return || e.keyval == Gdk.Key.KP_Enter) { | ||
118 | 188 | login.clicked (); | ||
119 | 189 | return true; | ||
120 | 190 | } else { | ||
121 | 191 | return false; | ||
122 | 192 | } | ||
123 | 193 | }); | ||
124 | 194 | |||
125 | 195 | spinner = new Gtk.Spinner (); | ||
126 | 196 | spinner.valign = Gtk.Align.CENTER; | ||
127 | 197 | spinner.start (); | ||
128 | 198 | spinner.set_size_request (92, 24); | ||
129 | 199 | |||
130 | 200 | grid = new Gtk.Grid (); | ||
131 | 201 | |||
132 | 202 | grid.attach (avatar, 0, 0, 1, 3); | ||
133 | 203 | grid.attach (settings, 2, 0, 1, 1); | ||
134 | 204 | grid.attach (username, 1, 0, 1, 1); | ||
135 | 205 | grid.attach (password, 1, 1, 2, 1); | ||
136 | 206 | grid.attach (login, 1, 2, 2, 1); | ||
137 | 207 | |||
138 | 208 | grid.margin = shadow_blur + 12; | ||
139 | 209 | grid.margin_top += 5; | ||
140 | 210 | grid.margin_bottom -= 12; | ||
141 | 211 | grid.column_spacing = 12; | ||
142 | 212 | |||
143 | 213 | avatar.draw.connect ((ctx) => { | ||
144 | 214 | Granite.Drawing.Utilities.cairo_rounded_rectangle (ctx, 0, 0, | ||
145 | 215 | avatar.get_allocated_width (), avatar.get_allocated_height (), 3); | ||
146 | 216 | Gdk.cairo_set_source_pixbuf (ctx, image, 0, 0); | ||
147 | 217 | ctx.fill_preserve (); | ||
148 | 218 | ctx.set_line_width (1); | ||
149 | 219 | ctx.set_source_rgba (0, 0, 0, 0.3); | ||
150 | 220 | ctx.stroke (); | ||
151 | 221 | return false; | ||
152 | 222 | }); | ||
153 | 223 | |||
154 | 224 | PopOver pop = null; | ||
155 | 225 | /*session choose popover*/ | ||
156 | 226 | this.settings.toggled.connect (() => { | ||
157 | 227 | if (!settings.active) { | ||
158 | 228 | pop.destroy (); | ||
159 | 229 | return; | ||
160 | 230 | } | ||
161 | 231 | |||
162 | 232 | pop = new PopOver (); | ||
163 | 233 | |||
164 | 234 | var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); | ||
165 | 235 | (pop.get_content_area () as Gtk.Container).add (box); | ||
166 | 236 | |||
167 | 237 | var but = new Gtk.RadioButton.with_label (null, LightDM.get_sessions ().nth_data (0).name); | ||
168 | 238 | box.pack_start (but, false); | ||
169 | 239 | but.active = LightDM.get_sessions ().nth_data (0).key == current_session; | ||
170 | 240 | |||
171 | 241 | but.toggled.connect (() => { | ||
172 | 242 | if (but.active) | ||
173 | 243 | current_session = LightDM.get_sessions ().nth_data (0).key; | ||
174 | 244 | }); | ||
175 | 245 | |||
176 | 246 | for (var i = 1;i < LightDM.get_sessions ().length (); i++) { | ||
177 | 247 | var rad = new Gtk.RadioButton.with_label_from_widget (but, LightDM.get_sessions ().nth_data (i).name); | ||
178 | 248 | box.pack_start (rad, false); | ||
179 | 249 | rad.active = LightDM.get_sessions ().nth_data (i).key == current_session; | ||
180 | 250 | var identifier = LightDM.get_sessions ().nth_data (i).key; | ||
181 | 251 | rad.toggled.connect ( () => { | ||
182 | 252 | if (rad.active) | ||
183 | 253 | current_session = identifier; | ||
184 | 254 | }); | ||
185 | 255 | } | ||
186 | 256 | |||
187 | 257 | this.get_stage ().add_child (pop); | ||
188 | 258 | |||
189 | 259 | pop.x = this.x + this.width - 265; | ||
190 | 260 | pop.width = 245; | ||
191 | 261 | pop.y = this.y + 50; | ||
192 | 262 | pop.get_widget ().show_all (); | ||
193 | 263 | pop.destroy.connect (() => { | ||
194 | 264 | settings.active = false; | ||
195 | 265 | }); | ||
196 | 266 | }); | ||
197 | 267 | |||
198 | 268 | /* draw the window stylish! */ | ||
199 | 269 | var css = new Gtk.CssProvider (); | ||
200 | 270 | try { | ||
201 | 271 | css.load_from_data (LIGHT_WINDOW_STYLE, -1); | ||
202 | 272 | } catch (Error e) { | ||
203 | 273 | warning (e.message); | ||
204 | 274 | } | ||
205 | 275 | |||
206 | 276 | draw_ref = new Gtk.Window (); | ||
207 | 277 | draw_ref.get_style_context ().add_class ("content-view-window"); | ||
208 | 278 | draw_ref.get_style_context ().add_provider (css, Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK); | ||
209 | 279 | |||
210 | 280 | var w = -1; var h = -1; | ||
211 | 281 | this.get_widget ().size_allocate.connect (() => { | ||
212 | 282 | if (w == this.get_widget ().get_allocated_width () && | ||
213 | 283 | h == this.get_widget ().get_allocated_height ()) | ||
214 | 284 | return; | ||
215 | 285 | |||
216 | 286 | w = this.get_widget ().get_allocated_width (); | ||
217 | 287 | h = this.get_widget ().get_allocated_height (); | ||
218 | 288 | |||
219 | 289 | this.buffer = new Granite.Drawing.BufferSurface (w, h); | ||
220 | 290 | |||
221 | 291 | this.buffer.context.rectangle (shadow_blur + shadow_x + 3, | ||
222 | 292 | shadow_blur + shadow_y*2, w - shadow_blur*2 + shadow_x - 6, h - shadow_blur*2 - shadow_y); | ||
223 | 293 | this.buffer.context.set_source_rgba (0, 0, 0, shadow_alpha); | ||
224 | 294 | this.buffer.context.fill (); | ||
225 | 295 | this.buffer.exponential_blur (shadow_blur / 2-2); | ||
226 | 296 | |||
227 | 297 | draw_ref.get_style_context ().render_activity (this.buffer.context, shadow_blur + shadow_x, | ||
228 | 298 | shadow_blur + shadow_y -2, w - shadow_blur*2 + shadow_x, h - shadow_blur*2); | ||
229 | 299 | }); | ||
230 | 300 | |||
231 | 301 | this.get_widget ().draw.connect ((ctx) => { | ||
232 | 302 | ctx.rectangle (0, 0, w, h); | ||
233 | 303 | ctx.set_operator (Cairo.Operator.SOURCE); | ||
234 | 304 | ctx.set_source_rgba (0, 0, 0, 0); | ||
235 | 305 | ctx.fill (); | ||
236 | 306 | |||
237 | 307 | ctx.set_source_surface (buffer.surface, 0, 0); | ||
238 | 308 | ctx.paint (); | ||
239 | 309 | |||
240 | 310 | return false; | ||
241 | 311 | }); | ||
242 | 312 | |||
243 | 313 | ((Gtk.Container) this.get_widget ()).add (grid); | ||
244 | 314 | this.get_widget ().show_all (); | ||
245 | 315 | this.get_widget ().get_style_context ().add_class ("content-view"); | ||
246 | 316 | } | ||
247 | 317 | |||
248 | 318 | public static string get_user_markup (LightDM.User? user, bool title=false) { | ||
249 | 319 | if (user.real_name != null && user != null) { | ||
250 | 320 | return "<span face='Open Sans Light' font='24'>" + shorten_user_name(user.real_name) + "</span>"; | ||
251 | 321 | >>>>>>> MERGE-SOURCE | ||
252 | 108 | } else { | 322 | } else { |
253 | 109 | user.avatar_updated.connect (() => { | 323 | user.avatar_updated.connect (() => { |
254 | 110 | update_avatar (); | 324 | update_avatar (); |
255 | @@ -130,6 +344,47 @@ | |||
256 | 130 | return credentials.userpassword; | 344 | return credentials.userpassword; |
257 | 131 | } | 345 | } |
258 | 132 | 346 | ||
259 | 347 | public static string shorten_user_name (string iname) { | ||
260 | 348 | string name = iname.strip(); | ||
261 | 349 | if(name.length < username_maxlength) { | ||
262 | 350 | return name; | ||
263 | 351 | } else { | ||
264 | 352 | if(name.contains (" ")) { | ||
265 | 353 | string[] tokens = name.split(" "); | ||
266 | 354 | string result = ""; | ||
267 | 355 | int last_shortened = 1; | ||
268 | 356 | bool unable_to_shorten = false; | ||
269 | 357 | while(true) { | ||
270 | 358 | int length = 0; | ||
271 | 359 | for(int i = 0; i < tokens.length; i++) { | ||
272 | 360 | length += tokens[i].length; | ||
273 | 361 | } | ||
274 | 362 | if(length > username_maxlength) { | ||
275 | 363 | string token = tokens[last_shortened]; | ||
276 | 364 | if(token.length > 2) | ||
277 | 365 | tokens[last_shortened] = | ||
278 | 366 | token.get_char(0).to_string() + "."; | ||
279 | 367 | last_shortened++; | ||
280 | 368 | if(last_shortened == tokens.length) { | ||
281 | 369 | unable_to_shorten = true; | ||
282 | 370 | break; | ||
283 | 371 | } | ||
284 | 372 | } | ||
285 | 373 | else | ||
286 | 374 | break; | ||
287 | 375 | } | ||
288 | 376 | for(int i = 0; i < tokens.length; i++) { | ||
289 | 377 | result += tokens[i] + " "; | ||
290 | 378 | } | ||
291 | 379 | if(unable_to_shorten) | ||
292 | 380 | return result.substring(0, username_maxlength - 1 ) + "…"; | ||
293 | 381 | else | ||
294 | 382 | return result.strip(); | ||
295 | 383 | } | ||
296 | 384 | return name.substring(0, username_maxlength - 1 ) + "…"; | ||
297 | 385 | } | ||
298 | 386 | } | ||
299 | 387 | |||
300 | 133 | public void wrong_pw () { | 388 | public void wrong_pw () { |
301 | 134 | credentials.reset_pw (); | 389 | credentials.reset_pw (); |
302 | 135 | this.animate (Clutter.AnimationMode.EASE_IN_BOUNCE, 150, scale_x: 0.9f, scale_y: 0.9f). | 390 | this.animate (Clutter.AnimationMode.EASE_IN_BOUNCE, 150, scale_x: 0.9f, scale_y: 0.9f). |
303 | 136 | 391 | ||
304 | === added directory 'tests' | |||
305 | === added file 'tests/CMakeLists.txt' | |||
306 | --- tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
307 | +++ tests/CMakeLists.txt 2014-03-31 08:54:15 +0000 | |||
308 | @@ -0,0 +1,21 @@ | |||
309 | 1 | enable_testing(true) | ||
310 | 2 | include_directories(. ../src) | ||
311 | 3 | |||
312 | 4 | find_package(PkgConfig) | ||
313 | 5 | pkg_check_modules(GLIB REQUIRED glib-2.0 gee-1.0) | ||
314 | 6 | add_definitions(${GLIB_CFLAGS} ${GLIB_CFLAGS_OTHER}) | ||
315 | 7 | link_libraries(${GLIB_LIBRARIES}) | ||
316 | 8 | link_directories(${GLIB_LIBRARY_DIRS}) | ||
317 | 9 | |||
318 | 10 | vala_precompile(VALA_C | ||
319 | 11 | Main.vala | ||
320 | 12 | TestCase.vala | ||
321 | 13 | NameTruncateTest.vala | ||
322 | 14 | PACKAGES | ||
323 | 15 | glib-2.0 | ||
324 | 16 | posix | ||
325 | 17 | ) | ||
326 | 18 | |||
327 | 19 | add_executable(unittests ${VALA_C}) | ||
328 | 20 | target_link_libraries(unittests ${LIBS}) | ||
329 | 21 | add_test(unittests ${CMAKE_CURRENT_BINARY_DIR}/unittests) | ||
330 | 0 | \ No newline at end of file | 22 | \ No newline at end of file |
331 | 1 | 23 | ||
332 | === added file 'tests/Main.vala' | |||
333 | --- tests/Main.vala 1970-01-01 00:00:00 +0000 | |||
334 | +++ tests/Main.vala 2014-03-31 08:54:15 +0000 | |||
335 | @@ -0,0 +1,8 @@ | |||
336 | 1 | using GLib; | ||
337 | 2 | |||
338 | 3 | public static int main(string[] args) | ||
339 | 4 | { | ||
340 | 5 | Test.init(ref args); | ||
341 | 6 | TestSuite.get_root().add_suite(new NameTruncateTest().get_suite()); | ||
342 | 7 | return Test.run(); | ||
343 | 8 | } | ||
344 | 0 | 9 | ||
345 | === added file 'tests/NameTruncateTest.vala' | |||
346 | --- tests/NameTruncateTest.vala 1970-01-01 00:00:00 +0000 | |||
347 | +++ tests/NameTruncateTest.vala 2014-03-31 08:54:15 +0000 | |||
348 | @@ -0,0 +1,29 @@ | |||
349 | 1 | using GLib; | ||
350 | 2 | |||
351 | 3 | public class NameTruncateTest : Gee.TestCase | ||
352 | 4 | { | ||
353 | 5 | |||
354 | 6 | public NameTruncateTest() | ||
355 | 7 | { | ||
356 | 8 | // assign a name for this class | ||
357 | 9 | base("NameTruncateTest"); | ||
358 | 10 | // add test methods | ||
359 | 11 | add_test("truncate_test", truncate_test); | ||
360 | 12 | } | ||
361 | 13 | |||
362 | 14 | public override void set_up() | ||
363 | 15 | { | ||
364 | 16 | // setup your test | ||
365 | 17 | } | ||
366 | 18 | |||
367 | 19 | public void truncate_test() | ||
368 | 20 | { | ||
369 | 21 | // add your expressions | ||
370 | 22 | assert(1 == 1); | ||
371 | 23 | } | ||
372 | 24 | |||
373 | 25 | public override void tear_down() | ||
374 | 26 | { | ||
375 | 27 | // tear down your test | ||
376 | 28 | } | ||
377 | 29 | } | ||
378 | 0 | \ No newline at end of file | 30 | \ No newline at end of file |
379 | 1 | 31 | ||
380 | === added file 'tests/TestCase.vala' | |||
381 | --- tests/TestCase.vala 1970-01-01 00:00:00 +0000 | |||
382 | +++ tests/TestCase.vala 2014-03-31 08:54:15 +0000 | |||
383 | @@ -0,0 +1,58 @@ | |||
384 | 1 | public abstract class Gee.TestCase : Object { | ||
385 | 2 | |||
386 | 3 | private GLib.TestSuite suite; | ||
387 | 4 | private Adaptor[] adaptors = new Adaptor[0]; | ||
388 | 5 | |||
389 | 6 | public delegate void TestMethod (); | ||
390 | 7 | |||
391 | 8 | public TestCase (string name) { | ||
392 | 9 | this.suite = new GLib.TestSuite (name); | ||
393 | 10 | } | ||
394 | 11 | |||
395 | 12 | public void add_test (string name, owned TestMethod test) { | ||
396 | 13 | var adaptor = new Adaptor (name, (owned)test, this); | ||
397 | 14 | this.adaptors += adaptor; | ||
398 | 15 | |||
399 | 16 | this.suite.add (new GLib.TestCase (adaptor.name, | ||
400 | 17 | adaptor.set_up, | ||
401 | 18 | adaptor.run, | ||
402 | 19 | adaptor.tear_down )); | ||
403 | 20 | } | ||
404 | 21 | |||
405 | 22 | public virtual void set_up () { | ||
406 | 23 | } | ||
407 | 24 | |||
408 | 25 | public virtual void tear_down () { | ||
409 | 26 | } | ||
410 | 27 | |||
411 | 28 | public GLib.TestSuite get_suite () { | ||
412 | 29 | return this.suite; | ||
413 | 30 | } | ||
414 | 31 | |||
415 | 32 | private class Adaptor { | ||
416 | 33 | |||
417 | 34 | public string name { get; private set; } | ||
418 | 35 | private TestMethod test; | ||
419 | 36 | private TestCase test_case; | ||
420 | 37 | |||
421 | 38 | public Adaptor (string name, | ||
422 | 39 | owned TestMethod test, | ||
423 | 40 | TestCase test_case) { | ||
424 | 41 | this.name = name; | ||
425 | 42 | this.test = (owned)test; | ||
426 | 43 | this.test_case = test_case; | ||
427 | 44 | } | ||
428 | 45 | |||
429 | 46 | public void set_up (void* fixture) { | ||
430 | 47 | this.test_case.set_up (); | ||
431 | 48 | } | ||
432 | 49 | |||
433 | 50 | public void run (void* fixture) { | ||
434 | 51 | this.test (); | ||
435 | 52 | } | ||
436 | 53 | |||
437 | 54 | public void tear_down (void* fixture) { | ||
438 | 55 | this.test_case.tear_down (); | ||
439 | 56 | } | ||
440 | 57 | } | ||
441 | 58 | } | ||
442 | 0 | \ No newline at end of file | 59 | \ No newline at end of file |
Has conflicts