Update with current status
[gnash.git] / testsuite / misc-ming.all / morph_test1runner.cpp
blob4c8185c72e0aff5ea2dd73180541d180e95f163c
1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
3 * Free Software Foundation, Inc.
4 *
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.
9 *
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
20 */
22 #define INPUT_FILENAME "morph_test1.swf"
24 #include "MovieTester.h"
25 #include "MovieClip.h"
26 #include "DisplayObject.h"
27 #include "DisplayList.h"
28 #include "log.h"
30 #include "check.h"
31 #include <string>
32 #include <cassert>
34 using namespace gnash;
35 using namespace std;
37 TRYMAIN(_runtest);
38 int
39 trymain(int /*argc*/, char** /*argv*/)
41 //string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
42 string filename = string(INPUT_FILENAME);
43 MovieTester tester(filename);
45 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
46 dbglogfile.setVerbosity(1);
49 rgba red(255,0,0,255); //start color
50 rgba green(0,255,0,255); //end color
52 MovieClip* root = tester.getRootMovie();
53 assert(root);
54 check_equals(root->get_frame_count(), 8);
56 // FRAME 2
57 tester.advance();
58 // fill color: 1.0*red + 0.0*green
59 // center coordinates: <start_x+50, start_y+50>
60 check_pixel(50, 50, 50, red, 2); // morph ratio = 0
62 // FRAME 3
63 tester.advance();
64 // 0.8*red + 0.2*green
65 // center coordinates: <0.8*start_x+0.2*end_x+50, 0.8*start_y+0.2*end_y+50>
66 check_pixel(190, 150, 50, rgba(204,51,0,255), 2); // morph ratio = 0.2
68 // FRAME 4
69 tester.advance();
70 // fill color: 0.6*red + 0.4*green
71 check_pixel(330, 250, 50, rgba(153,102,0,255), 2); // morph ratio = 0.4
73 // FRAME 5
74 tester.advance();
75 // fill color: 0.4*red + 0.6*green
76 check_pixel(470, 350, 50, rgba(102,153,0,255), 2); // morph ratio = 0.6
78 // FRAME 6
79 tester.advance();
80 // fill color: 0.2*red + 0.8*green
81 check_pixel(610, 450, 50, rgba(51,204,0,255), 2); // morph ratio = 0.8
83 // FRAME 7
84 tester.advance();
85 // fill color: 0.0*red + 1.0*green
86 check_pixel(750, 550, 50, rgba(0,255,0,255), 2); // morph ratio = 1.0
88 // Frame 8
89 tester.advance();
90 // #39989. Nothing to check: empty morph shape.
91 return 0;