big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / testsuite / misc-ming.all / morph_test1runner.cpp
blobfe8443f1692b358463a0f7eb3b0235bf42ff100c
1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program 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
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
21 #define INPUT_FILENAME "morph_test1.swf"
23 #include "MovieTester.h"
24 #include "MovieClip.h"
25 #include "DisplayObject.h"
26 #include "DisplayList.h"
27 #include "log.h"
29 #include "check.h"
30 #include <string>
31 #include <cassert>
33 using namespace gnash;
34 using namespace std;
36 int
37 main(int /*argc*/, char** /*argv*/)
39 //string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
40 string filename = string(INPUT_FILENAME);
41 MovieTester tester(filename);
43 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
44 dbglogfile.setVerbosity(1);
47 rgba red(255,0,0,255); //start color
48 rgba green(0,255,0,255); //end color
50 MovieClip* root = tester.getRootMovie();
51 assert(root);
52 check_equals(root->get_frame_count(), 7);
54 // FRAME 2
55 tester.advance();
56 // fill color: 1.0*red + 0.0*green
57 // center coordinates: <start_x+50, start_y+50>
58 check_pixel(50, 50, 50, red, 2); // morph ratio = 0
60 // FRAME 3
61 tester.advance();
62 // 0.8*red + 0.2*green
63 // center coordinates: <0.8*start_x+0.2*end_x+50, 0.8*start_y+0.2*end_y+50>
64 check_pixel(190, 150, 50, rgba(204,51,0,255), 2); // morph ratio = 0.2
66 // FRAME 4
67 tester.advance();
68 // fill color: 0.6*red + 0.4*green
69 check_pixel(330, 250, 50, rgba(153,102,0,255), 2); // morph ratio = 0.4
71 // FRAME 5
72 tester.advance();
73 // fill color: 0.4*red + 0.6*green
74 check_pixel(470, 350, 50, rgba(102,153,0,255), 2); // morph ratio = 0.6
76 // FRAME 6
77 tester.advance();
78 // fill color: 0.2*red + 0.8*green
79 check_pixel(610, 450, 50, rgba(51,204,0,255), 2); // morph ratio = 0.8
81 // FRAME 7
82 tester.advance();
83 // fill color: 0.0*red + 1.0*green
84 check_pixel(750, 550, 50, rgba(0,255,0,255), 2); // morph ratio = 1.0