elm.vapi: major update; catch up with changes up to upstream rev 45522
[libeflvala.git] / tests / testecore.vala
blob141b80bd010d89adb5ab8dc4386b8d16392be315
1 /**
2 * Copyright (C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 using Ecore;
22 public class Delegates : GLib.Object
24 int magic;
26 public Delegates()
28 magic = 42;
31 public bool idle_callback()
33 assert( magic == 42 );
34 Ecore.MainLoop.quit();
35 return false; // don't call me again
38 public bool idle_enterer()
40 assert( magic == 42 );
41 Ecore.MainLoop.quit();
42 return false;
45 public bool idle_exiter()
47 assert( magic == 42 );
48 Ecore.MainLoop.quit();
49 return false;
52 public bool timeout()
54 assert( magic == 42 );
55 Ecore.MainLoop.quit();
56 return false;
61 public void test_mainloop_idler()
63 init();
64 var delegates = new Delegates();
65 var i = new Idler( delegates.idle_callback );
66 Ecore.MainLoop.begin();
67 shutdown();
70 public void test_mainloop_idle_enterer()
72 init();
73 var delegates = new Delegates();
74 var i = new IdleEnterer( delegates.idle_enterer );
75 Ecore.MainLoop.begin();
76 shutdown();
79 public void test_mainloop_idle_exiter()
81 init();
82 var delegates = new Delegates();
83 var i = new IdleExiter( delegates.idle_exiter );
84 Ecore.MainLoop.begin();
85 shutdown();
88 public void test_mainloop_timer_timeout()
90 init();
91 var delegates = new Delegates();
92 var i = new Ecore.Timer( 1.0, delegates.timeout );
93 Ecore.MainLoop.begin();
94 shutdown();
98 //===========================================================================
99 void main (string[] args)
101 Test.init(ref args);
103 Test.add_func("/MainLoop/Idler", test_mainloop_idler);
104 Test.add_func("/MainLoop/IdleEnterer", test_mainloop_idle_enterer);
105 //Test.add_func("/MainLoop/IdleExiter", test_mainloop_idle_exiter);
106 Test.add_func("/MainLoop/Timer/Timeout", test_mainloop_timer_timeout);
108 Test.run ();