~ubuntu-branches/ubuntu/karmic/gnash/karmic

« back to all changes in this revision

Viewing changes to testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2008-10-13 14:29:49 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20081013142949-f6qdvnu4mn05ltdc
Tags: 0.8.4~~bzr9980-0ubuntu1
* new upstream release 0.8.4 (LP: #240325)
* ship new lib usr/lib/gnash/libmozsdk.so.* in mozilla-plugin-gnash
  - update debian/mozilla-plugin-gnash.install
* ship new lib usr/lib/gnash/libgnashnet.so.* in gnash-common
  - update debian/gnash-common.install
* add basic debian/build_head script to build latest CVS head packages.
  - add debian/build_head
* new sound architecture requires build depend on libsdl1.2-dev
  - update debian/control
* head build script now has been completely migrated to bzr (upstream +
  ubuntu)
  - update debian/build_head
* disable kde gui until klash/qt4 has been fixed; keep kde packages as empty
  packages for now.
  - update debian/rules
  - debian/klash.install
  - debian/klash.links
  - debian/klash.manpages
  - debian/konqueror-plugin-gnash.install
* drop libkonq5-dev build dependency accordingly
  - update debian/control
* don't install headers manually anymore. gnash doesnt provide a -dev
  package after all
  - update debian/rules
* update libs installed in gnash-common; libgnashserver-*.so is not available
  anymore (removed); in turn we add the new libgnashcore-*.so
  - update debian/gnash-common.install
* use -Os for optimization and properly pass CXXFLAGS=$(CFLAGS) to configure
  - update debian/rules
* touch firefox .autoreg in postinst of mozilla plugin
  - update debian/mozilla-plugin-gnash.postinst
* link gnash in ubufox plugins directory for the plugin alternative switcher
  - add debian/mozilla-plugin-gnash.links
* suggest ubufox accordingly
  - update debian/control
* add new required build-depends on libgif-dev
  - update debian/control
* add Xb-Npp-Description and Xb-Npp-File as new plugin database meta data
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "MovieTester.h"
24
24
#include "sprite_instance.h"
25
25
#include "character.h"
26
 
#include "dlist.h"
 
26
#include "DisplayList.h"
27
27
#include "log.h"
28
28
 
29
29
#include "check.h"
37
37
test_mouse_activity(MovieTester& tester, const character* text, const character* text2, bool covered, bool enabled)
38
38
{
39
39
        rgba red(255,0,0,255);
 
40
        rgba dark_red(128,0,0,255);
40
41
        rgba covered_red(127,126,0,255); // red, covered by 50% black
 
42
        rgba covered_dark_red(64,120,0,255); // dark red, covered by 50% black
41
43
        rgba yellow(255,255,0,255);
 
44
        rgba dark_yellow(128,128,0,255);
42
45
        rgba covered_yellow(128,255,0,255); // yellow, covered by 50% black
 
46
        rgba covered_dark_yellow(64,184,0,255); // dark yellow, covered by 50% black
43
47
        rgba green(0,255,0,255);
44
48
 
45
49
        // roll over the middle of the square, this should change
49
53
                check_equals(string(text->get_text_value()), string("MouseOver"));
50
54
                check_equals(string(text2->get_text_value()), string("RollOver"));
51
55
                check(tester.isMouseOverMouseEntity());
52
 
                // check that pixel @ 60,60 is yellow !
53
 
                if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2);  }
54
 
                else { check_pixel(60, 60, 2, yellow, 2);  }
 
56
                if ( covered )
 
57
                {
 
58
                        // check that pixel @ 60,60 is yellow (covered)
 
59
                        check_pixel(60, 60, 2, covered_yellow, 2); 
 
60
                        // check that pixel @ 72,64 is dark_yellow (covered)
 
61
                        check_pixel(72, 64, 2, covered_dark_yellow, 2); 
 
62
                }
 
63
                else
 
64
                {
 
65
                        // check that pixel @ 60,60 is yellow 
 
66
                        check_pixel(60, 60, 2, yellow, 2); 
 
67
                        // check that pixel @ 72,64 is dark_yellow 
 
68
                        check_pixel(72, 64, 2, dark_yellow, 2); 
 
69
                }
55
70
        } else {
56
 
                check_equals(string(text->get_text_value()), string("MouseOut"));
57
 
                check_equals(string(text2->get_text_value()), string("RollOut"));
 
71
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
72
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
58
73
                check(!tester.isMouseOverMouseEntity());
59
 
                // check that pixel @ 60,60 is red !
60
 
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2);  }
61
 
                else { check_pixel(60, 60, 2, red, 2);  }
 
74
                if ( covered )
 
75
                {
 
76
                        // check that pixel @ 60,60 is red  (covered)
 
77
                        check_pixel(60, 60, 2, covered_red, 2); 
 
78
                        // check that pixel @ 72,64 is dark_red  (covered)
 
79
                        check_pixel(72, 64, 2, covered_dark_red, 2); 
 
80
                }
 
81
                else
 
82
                {
 
83
                        // check that pixel @ 60,60 is red 
 
84
                        check_pixel(60, 60, 2, red, 2); 
 
85
                        // check that pixel @ 72,64 is dark_red 
 
86
                        check_pixel(72, 64, 2, dark_red, 2); 
 
87
                }
62
88
        }
63
89
 
64
90
        // press the mouse button, this should change
71
97
                // check that pixel @ 60,60 is green !
72
98
                check_pixel(60, 60, 2, green, 2);
73
99
        } else {
74
 
                check_equals(string(text->get_text_value()), string("MouseOut"));
75
 
                check_equals(string(text2->get_text_value()), string("RollOut"));
 
100
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
101
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
76
102
                check(!tester.isMouseOverMouseEntity());
77
103
                // check that pixel @ 60,60 is red !
78
104
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2);  }
90
116
                if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2);  }
91
117
                else { check_pixel(60, 60, 2, yellow, 2);  }
92
118
        } else {
93
 
                check_equals(string(text->get_text_value()), string("MouseOut"));
94
 
                check_equals(string(text2->get_text_value()), string("RollOut"));
 
119
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
120
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
95
121
                check(!tester.isMouseOverMouseEntity());
96
122
                // check that pixel @ 60,60 is red !
97
123
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2);  }
101
127
        // roll off the square, this should change
102
128
        // the textfield value, if enabled
103
129
        tester.movePointerTo(39, 60);
104
 
        check_equals(string(text->get_text_value()), string("MouseOut"));
105
 
        check_equals(string(text2->get_text_value()), string("RollOut"));
 
130
        if ( enabled ) {
 
131
                check_equals(string(text->get_text_value()), string("MouseOut"));
 
132
                check_equals(string(text2->get_text_value()), string("RollOut"));
 
133
        } else {
 
134
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
135
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
 
136
        }
106
137
        check(!tester.isMouseOverMouseEntity());
107
138
        // check that pixel @ 60,60 is red !
108
139
        if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
111
142
        // press the mouse button, this should not change anything
112
143
        // as we're outside of the button.
113
144
        tester.pressMouseButton();
114
 
        check_equals(string(text->get_text_value()), string("MouseOut"));
115
 
        check_equals(string(text2->get_text_value()), string("RollOut"));
 
145
        if ( enabled ) {
 
146
                check_equals(string(text->get_text_value()), string("MouseOut"));
 
147
                check_equals(string(text2->get_text_value()), string("RollOut"));
 
148
        } else {
 
149
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
150
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
 
151
        }
116
152
        check(!tester.isMouseOverMouseEntity());
117
153
        // check that pixel @ 60,60 is red !
118
154
        if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
121
157
        // depress the mouse button, this should not change anything
122
158
        // as we're outside of the button.
123
159
        tester.depressMouseButton();
124
 
        check_equals(string(text->get_text_value()), string("MouseOut"));
125
 
        check_equals(string(text2->get_text_value()), string("RollOut"));
 
160
        if ( enabled ) {
 
161
                check_equals(string(text->get_text_value()), string("MouseOut"));
 
162
                check_equals(string(text2->get_text_value()), string("RollOut"));
 
163
        } else {
 
164
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
165
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
 
166
        }
126
167
        check(!tester.isMouseOverMouseEntity());
127
168
        // check that pixel @ 60,60 is red !
128
169
        if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
140
181
                if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2);  }
141
182
                else { check_pixel(60, 60, 2, yellow, 2);  }
142
183
        } else {
143
 
                check_equals(string(text->get_text_value()), string("MouseOut"));
144
 
                check_equals(string(text2->get_text_value()), string("RollOut"));
 
184
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
185
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
145
186
                check(!tester.isMouseOverMouseEntity());
146
187
                // check that pixel @ 60,60 is red !
147
188
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
157
198
                // check that pixel @ 60,60 is green !
158
199
                check_pixel(60, 60, 2, rgba(0,255,0,255), 2);
159
200
        } else {
160
 
                check_equals(string(text->get_text_value()), string("MouseOut"));
161
 
                check_equals(string(text2->get_text_value()), string("RollOut"));
 
201
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
202
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
162
203
                check(!tester.isMouseOverMouseEntity());
163
204
                // check that pixel @ 60,60 is red !
164
205
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
172
213
        tester.depressMouseButton();
173
214
 
174
215
        if ( enabled ) {
175
 
                xcheck_equals(string(text->get_text_value()), string("MouseUpOutside"));
176
 
                xcheck_equals(string(text2->get_text_value()), string("ReleaseOutside"));
 
216
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
217
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
177
218
        } else {
178
 
                check_equals(string(text->get_text_value()), string("MouseOut"));
179
 
                check_equals(string(text2->get_text_value()), string("RollOut"));
 
219
                check_equals(string(text->get_text_value()), string("MouseUpOutside"));
 
220
                check_equals(string(text2->get_text_value()), string("ReleaseOutside"));
180
221
        }
181
222
}
182
223
 
192
233
        sprite_instance* root = tester.getRootMovie();
193
234
        assert(root);
194
235
 
195
 
        check_equals(root->get_frame_count(), 4);
 
236
        check_equals(root->get_frame_count(), 7);
196
237
 
197
238
        check_equals(root->get_current_frame(), 0);
198
239
 
199
 
        const character* mc1 = tester.findDisplayItemByName(*root, "square1");
200
 
        check(mc1);
201
 
        check_equals(mc1->get_depth(), 2+character::staticDepthOffset);
202
 
 
203
240
        const character* text = tester.findDisplayItemByName(*root, "textfield");
204
241
        check(text);
205
242
 
212
249
        check_equals(string(text->get_text_value()), idleString);
213
250
        check_equals(string(text2->get_text_value()), idleString);
214
251
        check_equals(string(text3->get_text_value()), idleString);
 
252
 
 
253
        tester.advance();
 
254
        check_equals(root->get_current_frame(), 1);
 
255
 
 
256
        const character* mc1 = tester.findDisplayItemByName(*root, "square1");
 
257
        check(mc1);
 
258
        check_equals(mc1->get_depth(), 2+character::staticDepthOffset);
 
259
 
215
260
        check(!tester.isMouseOverMouseEntity());
216
261
        // check that pixel @ 60,60 is red !
217
262
        rgba red(255,0,0,255);
218
263
        check_pixel(60, 60, 2, red, 2);
219
264
 
220
 
        for (size_t fno=0; fno<root->get_frame_count(); fno++)
 
265
        tester.advance();
 
266
        check_equals(root->get_current_frame(), 2);
 
267
        tester.advance();
 
268
        check_equals(root->get_current_frame(), 2); // need to roll out
 
269
 
 
270
        tester.movePointerTo(60, 60); // roll over the square
 
271
        check_equals(root->get_current_frame(), 2); // need to roll out
 
272
        tester.movePointerTo(0, 0); // roll out, should go to next frame
 
273
        check_equals(root->get_current_frame(), 3); 
 
274
 
 
275
        for (size_t fno=root->get_current_frame(); fno<root->get_frame_count(); fno++)
221
276
        {
222
277
                const character* square_back = tester.findDisplayItemByDepth(*root, 1+character::staticDepthOffset);
223
278
                const character* square_front = tester.findDisplayItemByDepth(*root, 3+character::staticDepthOffset);
224
279
 
225
280
                switch (fno)
226
281
                {
227
 
                        case 0:
 
282
                        case 3:
228
283
                                check(!square_back);
229
284
                                check(!square_front);
230
285
                                break;
231
 
                        case 1:
 
286
                        case 4:
232
287
                                check(square_back);
233
288
                                check(!square_front);
234
289
                                break;
235
 
                        case 2:
 
290
                        case 5:
236
291
                                check(square_back);
237
292
                                check(square_front);
238
293
                                break;
250
305
 
251
306
        }
252
307
 
253
 
        // last advance should restart the loop...
254
 
        check_equals(root->get_current_frame(), 0);
 
308
        // last advance should not restart the loop (it's in STOP mode)
 
309
        check_equals(root->get_play_state(), sprite_instance::STOP);
 
310
        check_equals(root->get_current_frame(), 6);
255
311
 
256
312
}
257
313