Update with current status
[gnash.git] / testsuite / misc-ming.all / BeginBitmapFillRunner.cpp
blob7890e1758a53fdc785571535ad70594e55ad3fb2
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.
14 //
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
18 //
19 //
20 #define INPUT_FILENAME "BeginBitmapFill.swf"
22 #include "MovieTester.h"
23 #include "MovieClip.h"
24 #include "DisplayObject.h"
25 #include "DisplayList.h"
26 #include "log.h"
28 #include "check.h"
29 #include <string>
30 #include <cassert>
31 #include <sstream>
33 using namespace gnash;
34 using namespace gnash::geometry;
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 MovieTester tester(filename);
44 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
45 dbglogfile.setVerbosity(1);
47 MovieClip* root = tester.getRootMovie();
48 assert(root);
50 const rgba black(0, 0, 0, 255);
51 const rgba white(255, 255, 255, 255);
52 const rgba blue(0, 0, 255, 255);
53 const rgba cyan(0, 255, 255, 255);
54 const rgba green(0, 255, 0, 255);
55 const rgba yellow(255, 255, 0, 255);
56 const rgba magenta(255, 0, 255, 255);
57 const rgba red(255, 0, 0, 255);
58 const rgba lightgreen(0xaa, 0xff, 0x00, 0xff);
59 const rgba funnycyan(0x00, 0xcc, 0xff, 0xff);
60 const rgba lightcyan(0xaa, 0xff, 0xaa, 0xff);
62 tester.advance();
63 check_pixel(1, 1, 1, white, 2);
65 // Shape 1
66 // Red stripe
67 check_pixel(15, 15, 1, red, 2);
68 check_pixel(15, 85, 1, red, 2);
69 // Green stripe
70 check_pixel(30, 15, 1, green, 2);
71 check_pixel(30, 85, 1, green, 2);
72 // Blue
73 check_pixel(45, 15, 1, blue, 2);
74 check_pixel(45, 85, 1, blue, 2);
76 // Shape 2
77 // Red stripe
78 check_pixel(165, 15, 1, red, 2);
79 check_pixel(165, 85, 1, red, 2);
80 // Green stripe
81 check_pixel(180, 15, 1, green, 2);
82 check_pixel(180, 85, 1, green, 2);
83 // Blue
84 check_pixel(195, 15, 1, blue, 2);
85 // Cut due to the shape.
86 check_pixel(195, 87, 1, white, 2);
88 // Shape 3
89 // Red stripe
90 check_pixel(315, 14, 1, white, 2);
91 check_pixel(315, 85, 1, red, 2);
92 // Green stripe
93 check_pixel(330, 15, 1, white, 2);
94 check_pixel(330, 85, 1, green, 2);
95 // Blue
96 check_pixel(345, 15, 1, white, 2);
97 // Cut due to the shape.
98 check_pixel(345, 85, 1, blue, 2);
100 // Shape 4
101 // Skewed, scaled shape.
102 check_pixel(100, 200, 1, magenta, 2);
103 check_pixel(150, 200, 1, yellow, 2);
104 check_pixel(230, 200, 1, cyan, 2);
105 check_pixel(235, 250, 1, magenta, 2);
106 check_pixel(315, 250, 1, yellow, 2);
107 check_pixel(395, 250, 1, white, 2);
109 // Shape 5
110 check_pixel(30, 315, 1, black, 2);
111 check_pixel(70, 315, 1, black, 2);
112 check_pixel(140, 315, 1, white, 2);
113 check_pixel(170, 315, 1, black, 2);
114 check_pixel(30, 330, 1, lightgreen, 2);
115 check_pixel(70, 330, 1, lightgreen, 2);
116 check_pixel(140, 330, 1, white, 2);
117 check_pixel(170, 330, 1, lightgreen, 2);
118 check_pixel(30, 345, 1, funnycyan, 2);
119 check_pixel(70, 345, 1, funnycyan, 2);
120 check_pixel(140, 345, 1, white, 2);
121 check_pixel(170, 345, 1, funnycyan, 2);
123 // Shape 6
124 // Edge pixels extend to edge of shape
125 // Top left
126 check_pixel(298, 298, 1, white, 2);
127 check_pixel(302, 302, 1, black, 2);
128 // Centre of fill
129 check_pixel(352, 352, 1, black, 2);
130 check_pixel(352, 362, 1, lightcyan, 2);
131 check_pixel(362, 362, 1, lightgreen, 2);
132 // Bottom left
133 check_pixel(302, 398, 1, lightcyan, 2);
134 check_pixel(298, 398, 1, white, 2);
135 // Bottom right
136 check_pixel(448, 398, 1, lightgreen, 2);
137 check_pixel(448, 402, 1, white, 2);
139 // Shape 7: tiled 20x20 blocks centred at (550, 550)
140 check_pixel(498, 298, 1, white, 2);
141 check_pixel(552, 352, 1, black, 2);
142 check_pixel(552, 362, 1, lightcyan, 2);
143 check_pixel(562, 362, 1, lightgreen, 2);
144 // 20 right
145 check_pixel(572, 352, 1, black, 2);
146 check_pixel(572, 362, 1, lightcyan, 2);
147 check_pixel(582, 362, 1, lightgreen, 2);
148 // 20 down
149 check_pixel(552, 372, 1, black, 2);
150 check_pixel(552, 382, 1, lightcyan, 2);
151 check_pixel(562, 382, 1, lightgreen, 2);
152 // 20 right and down
153 check_pixel(572, 372, 1, black, 2);
154 check_pixel(572, 382, 1, lightcyan, 2);
155 check_pixel(582, 382, 1, lightgreen, 2);
156 // Some random blocks.
157 check_pixel(512, 312, 1, black, 2);
158 check_pixel(532, 382, 1, lightcyan, 2);
159 check_pixel(522, 362, 1, lightgreen, 2);
161 // Shape 8
162 // This should change with the BitmapData.
163 check_pixel(20, 465, 1, red, 2);
165 // Shape 9
166 // This should not display because the BitmapData is disposed.
167 check_pixel(460, 460, 1, white, 2);
168 check_pixel(500, 460, 1, white, 2);
169 check_pixel(460, 500, 1, white, 2);
171 return 0;