2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 * Free Software Foundation, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #define INPUT_FILENAME "DefineTextTest.swf"
24 #include "MovieTester.h"
25 #include "MovieClip.h"
26 #include "DisplayObject.h"
27 #include "DisplayList.h"
30 #include "string_table.h"
36 using namespace gnash
;
41 trymain(int /*argc*/, char** /*argv*/)
43 string filename
= string(TGTDIR
) + string("/") + string(INPUT_FILENAME
);
44 MovieTester
tester(filename
);
46 gnash::LogFile
& dbglogfile
= gnash::LogFile::getDefaultInstance();
47 dbglogfile
.setVerbosity(1);
49 MovieClip
* root
= tester
.getRootMovie();
52 check_equals(root
->get_frame_count(), 4);
53 check_equals(root
->getPlayState(), MovieClip::PLAYSTATE_PLAY
);
54 check_equals(root
->get_current_frame(), 0);
56 rgba
white(255,255,255,255);
57 rgba
red(255,0,0,255);
58 rgba
green(0,255,0,255);
60 geometry::Point2d
cXmm(220,327); // DisplayObject X center
61 geometry::Point2d
cXum(220,440); // DisplayObject X underline/middle
63 geometry::Point2d
cOmr(135,326); // DisplayObject O middle/right
64 geometry::Point2d
cOml(21,330); // DisplayObject O middle/left
65 geometry::Point2d
cOmm(77,327); // DisplayObject O center
66 geometry::Point2d
cOum(78,440); // DisplayObject O underline/middle
69 tester
.advance(); // first frame only contains dejagnu
70 check_equals(root
->get_current_frame(), 1);
72 check_pixel(cXmm
.x
, cXmm
.y
, 4, red
, 2); // X cross
73 check_pixel(cXum
.x
, cXum
.y
, 20, white
, 2); // X underline (none)
75 check_pixel(cOmm
.x
, cOmm
.y
, 8, white
, 2); // O hole
76 check_pixel(cOml
.x
, cOml
.y
, 4, green
, 2); // O left side
77 check_pixel(cOmr
.x
, cOmr
.y
, 4, green
, 2); // O right side
78 check_pixel(cOum
.x
, cOum
.y
, 20, white
, 2); // O underline (none)
82 // Move to left part of O
83 tester
.movePointerTo(cOml
.x
, cOml
.y
);
88 // Move to centre of O
89 tester
.movePointerTo(cOmm
.x
, cOmm
.y
);
91 // Click there a lot (shouldn't be registered)
101 // Move to right part of O
102 tester
.movePointerTo(cOmr
.x
, cOmr
.y
);
106 tester
.movePointerTo(1, 1);
108 // Just for fun. These shouldn't be registered.
115 for (int i
=0; i
<3; ++i
) tester
.advance(); // get to the end
117 VM
& vm
= tester
.vm();
120 bool endOfTestFound
= getObject(root
)->get_member(getURI(vm
, "endoftest"), &eot
);
121 check(endOfTestFound
);
122 check(eot
.is_bool());
123 check(eot
.to_bool(8));
125 // TODO: use check_pixel for checking bacground colors