2
* Copyright (C) 2010 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by Neil Jagdish Patel <neil.patel@canonical.com>
26
on_animation_started (Clutter.Animation? anim)
28
//stdout.printf("Animation Started\n");
33
on_animation_completed (Clutter.Animation? anim)
35
//stdout.printf("Animation Completed\n");
39
namespace Unity.Tests.UI
41
public class AutomationBasicTestSuite : Object
43
private const string DOMAIN = "/UI/Quicklist";
45
Unity.Testing.Window? window;
48
public AutomationBasicTestSuite ()
50
Logging.init_fatal_handler ();
52
/* Testup the test window */
53
window = new Unity.Testing.Window (true, 1024, 600);
54
window.init_test_mode ();
56
window.title = "Automation Tests";
59
Test.add_data_func (DOMAIN + "/Automation",
63
/* Keep this one last, it's a dummy to clean up the state as Vala cant
64
* deal with the standard TestSuite stuff properly
66
Test.add_data_func (DOMAIN +"/Teardown", test_teardown);
69
private void test_teardown ()
75
private void test_automation ()
78
ObjectRegistry registry = ObjectRegistry.get_default ();
80
Logging.init_fatal_handler ();
82
QuicklistController qlcontroller = QuicklistController.get_default ();
83
ScrollerModel scroller = registry.lookup ("UnityScrollerModel").get(0) as ScrollerModel;
85
gTimer = new GLib.Timer();
89
foreach (ScrollerChild launcher in scroller)
91
//launcher = scroller[i] as ScrollerChild;
92
var dir = new Director (launcher.get_stage() as Clutter.Stage);
94
qlcontroller.show_label ("Ubuntu Software Centre", launcher);
96
Clutter.Animation? anim;
97
launcher.opacity = 255;
101
anim = launcher.animate (Clutter.AnimationMode.EASE_IN_SINE, 2500, "opacity", 0);
102
//anim.started.connect (on_animation_started);
103
anim.completed.connect (on_animation_completed);
104
dir.do_wait_for_animation (launcher);
106
float dt = (float)gTimer.elapsed ();
107
float dt0 = (float)DT/1000.0f;
108
stdout.printf("Expected Duration: %2.3f, Observed Duration: %2.3f, Error: %2.3f%%\n", dt0, dt,
109
(dt - dt0)*100.0f/dt0);
112
anim = launcher.animate (Clutter.AnimationMode.EASE_IN_SINE, 2500, "opacity", 255);
113
//anim.started.connect (on_animation_started);
114
anim.completed.connect (on_animation_completed);
115
dir.do_wait_for_animation (launcher);
117
dt = (float)gTimer.elapsed ();
118
dt0 = (float)DT/1000.0f;
119
stdout.printf("Expected Duration: %2.3f, Observed Duration: %2.3f, Error: %2.3f%%\n", dt0, dt,
120
(dt - dt0)*100.0f/dt0);
123
//dir.do_wait_for_timeout (5000);
126
//debug ("After Animation");
127
qlcontroller.close_menu ();