@@ -154,15 +154,15 @@ TEST_F(RenderedTargetTest, UpdateMethods)
154154 EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
155155 EXPECT_CALL (engine, stageHeight ()).WillOnce (Return (360 ));
156156 target.updateX (12.5 );
157- ASSERT_EQ (target.x (), 275.5 );
157+ ASSERT_EQ (target.x (), 276 );
158158 ASSERT_EQ (target.y (), 108 );
159159
160160 // Y
161161 EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
162162 EXPECT_CALL (engine, stageHeight ()).WillOnce (Return (360 ));
163163 target.updateY (-76.09 );
164- ASSERT_EQ (target.x (), 275.5 );
165- ASSERT_EQ (std::round ( target.y () * 100 ) / 100 , 184.09 );
164+ ASSERT_EQ (target.x (), 276 );
165+ ASSERT_EQ (target.y (), 184 );
166166
167167 // Size
168168 EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
@@ -171,8 +171,8 @@ TEST_F(RenderedTargetTest, UpdateMethods)
171171 target.beforeRedraw ();
172172 ASSERT_EQ (target.width (), 4 );
173173 ASSERT_EQ (target.height (), 6 );
174- ASSERT_EQ (target.x (), 275.5 );
175- ASSERT_EQ (std::round ( target.y () * 100 ) / 100 , 184.09 );
174+ ASSERT_EQ (target.x (), 276 );
175+ ASSERT_EQ (target.y (), 184 );
176176 ASSERT_EQ (target.transformOriginPoint ().x (), -23 );
177177 ASSERT_EQ (target.transformOriginPoint ().y (), 72 );
178178
@@ -187,26 +187,26 @@ TEST_F(RenderedTargetTest, UpdateMethods)
187187 target.updateRotationStyle (Sprite::RotationStyle::LeftRight);
188188 ASSERT_EQ (target.mirrorHorizontally (), false );
189189 ASSERT_EQ (target.rotation (), 0 );
190- ASSERT_EQ (target.x (), 275.5 );
191- ASSERT_EQ (std::round ( target.y () * 100 ) / 100 , 184.09 );
190+ ASSERT_EQ (target.x (), 276 );
191+ ASSERT_EQ (target.y (), 184 );
192192 ASSERT_TRUE (mirrorHorizontallySpy.empty ());
193193
194194 EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
195195 EXPECT_CALL (engine, stageHeight ()).WillOnce (Return (360 ));
196196 target.updateDirection (-15 );
197197 ASSERT_EQ (target.mirrorHorizontally (), true );
198198 ASSERT_EQ (target.rotation (), 0 );
199- ASSERT_EQ (target.x (), 229.5 );
200- ASSERT_EQ (std::round ( target.y () * 100 ) / 100 , 184.09 );
199+ ASSERT_EQ (target.x (), 230 );
200+ ASSERT_EQ (target.y (), 184 );
201201 ASSERT_EQ (mirrorHorizontallySpy.count (), 1 );
202202
203203 EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
204204 EXPECT_CALL (engine, stageHeight ()).WillOnce (Return (360 ));
205205 target.updateDirection (134.89 );
206206 ASSERT_EQ (target.mirrorHorizontally (), false );
207207 ASSERT_EQ (target.rotation (), 0 );
208- ASSERT_EQ (target.x (), 275.5 );
209- ASSERT_EQ (std::round ( target.y () * 100 ) / 100 , 184.09 );
208+ ASSERT_EQ (target.x (), 276 );
209+ ASSERT_EQ (target.y (), 184 );
210210 ASSERT_EQ (mirrorHorizontallySpy.count (), 2 );
211211
212212 EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
@@ -223,8 +223,8 @@ TEST_F(RenderedTargetTest, UpdateMethods)
223223 target.beforeRedraw ();
224224 ASSERT_EQ (target.width (), 4 );
225225 ASSERT_EQ (target.height (), 6 );
226- ASSERT_EQ (target.x (), 401.75 );
227- ASSERT_EQ (std::round ( target.y () * 100 ) / 100 , 312.14 );
226+ ASSERT_EQ (target.x (), 402.5 );
227+ ASSERT_EQ (target.y (), 312 );
228228 ASSERT_EQ (target.z (), 3 );
229229 ASSERT_EQ (target.rotation (), 0 );
230230 ASSERT_EQ (target.transformOriginPoint ().x (), -23 );
@@ -241,8 +241,8 @@ TEST_F(RenderedTargetTest, UpdateMethods)
241241 target.beforeRedraw ();
242242 ASSERT_EQ (target.width (), 4 );
243243 ASSERT_EQ (target.height (), 6 );
244- ASSERT_EQ (target.x (), 378.75 );
245- ASSERT_EQ (std::round ( target.y () * 100 ) / 100 , 384.14 );
244+ ASSERT_EQ (target.x (), 379.5 );
245+ ASSERT_EQ (target.y (), 384 );
246246 ASSERT_EQ (target.transformOriginPoint ().x (), 0 );
247247 ASSERT_EQ (target.transformOriginPoint ().y (), 0 );
248248 ASSERT_EQ (target.transformOrigin (), QQuickItem::TopLeft);
@@ -263,8 +263,8 @@ TEST_F(RenderedTargetTest, UpdateMethods)
263263
264264 ASSERT_EQ (target.width (), 26 );
265265 ASSERT_EQ (target.height (), 26 );
266- ASSERT_EQ (target.x (), 328.75 );
267- ASSERT_EQ (std::round ( target.y () * 100 ) / 100 , 400.14 );
266+ ASSERT_EQ (target.x (), 329.5 );
267+ ASSERT_EQ (target.y (), 400 );
268268 ASSERT_EQ (target.z (), 3 );
269269 ASSERT_EQ (target.rotation (), 0 );
270270 ASSERT_EQ (target.transformOriginPoint ().x (), 50 );
@@ -375,48 +375,48 @@ TEST_F(RenderedTargetTest, CpuRendering)
375375
376376 // Test containsScratchPoint()
377377 target.updateDirection (0 );
378- ASSERT_FALSE (target.containsScratchPoint (-227.5 , 165 )); // [0, 0]
379- ASSERT_FALSE (target.containsScratchPoint (-226.5 , 165 )); // [1, 0]
380- ASSERT_FALSE (target.containsScratchPoint (-225.5 , 165 )); // [2, 0]
381- ASSERT_FALSE (target.containsScratchPoint (-224.5 , 165 )); // [3, 0]
382-
383- ASSERT_FALSE (target.containsScratchPoint (-227.5 , 164 )); // [0, 1]
384- ASSERT_TRUE (target.containsScratchPoint (-226.5 , 164 )); // [1, 1]
385- ASSERT_TRUE (target.containsScratchPoint (-226.1 , 163.75 )); // [1.4, 1.25]
386- ASSERT_TRUE (target.containsScratchPoint (-225.5 , 164 )); // [2, 1]
387- ASSERT_TRUE (target.containsScratchPoint (-224.5 , 164 )); // [3, 1]
388-
389- ASSERT_TRUE (target.containsScratchPoint (-226.5 , 163 )); // [1, 2]
390- ASSERT_FALSE (target.containsScratchPoint (-225.5 , 163 )); // [2, 2]
391- ASSERT_TRUE (target.containsScratchPoint (-224.5 , 163 )); // [3, 2]
392- ASSERT_FALSE (target.containsScratchPoint (-224 , 162.9 )); // [3.5, 2.1]
393-
394- ASSERT_TRUE (target.containsScratchPoint (-226.5 , 162 )); // [1, 3]
395- ASSERT_TRUE (target.containsScratchPoint (-225.5 , 162 )); // [2, 3]
396- ASSERT_TRUE (target.containsScratchPoint (-224.5 , 162 )); // [3, 3]
397- ASSERT_FALSE (target.containsScratchPoint (-224.2 , 161.5 )); // [3.3, 3.5]
378+ ASSERT_FALSE (target.containsScratchPoint (-228 , 165 )); // [0, 0]
379+ ASSERT_FALSE (target.containsScratchPoint (-227 , 165 )); // [1, 0]
380+ ASSERT_FALSE (target.containsScratchPoint (-226 , 165 )); // [2, 0]
381+ ASSERT_FALSE (target.containsScratchPoint (-225 , 165 )); // [3, 0]
382+
383+ ASSERT_FALSE (target.containsScratchPoint (-228 , 164 )); // [0, 1]
384+ ASSERT_TRUE (target.containsScratchPoint (-227 , 164 )); // [1, 1]
385+ ASSERT_TRUE (target.containsScratchPoint (-226.6 , 163.75 )); // [1.4, 1.25]
386+ ASSERT_TRUE (target.containsScratchPoint (-226 , 164 )); // [2, 1]
387+ ASSERT_TRUE (target.containsScratchPoint (-225 , 164 )); // [3, 1]
388+
389+ ASSERT_TRUE (target.containsScratchPoint (-227 , 163 )); // [1, 2]
390+ ASSERT_FALSE (target.containsScratchPoint (-226 , 163 )); // [2, 2]
391+ ASSERT_TRUE (target.containsScratchPoint (-225 , 163 )); // [3, 2]
392+ ASSERT_FALSE (target.containsScratchPoint (-224.5 , 162.9 )); // [3.5, 2.1]
393+
394+ ASSERT_TRUE (target.containsScratchPoint (-227 , 162 )); // [1, 3]
395+ ASSERT_TRUE (target.containsScratchPoint (-226 , 162 )); // [2, 3]
396+ ASSERT_TRUE (target.containsScratchPoint (-225 , 162 )); // [3, 3]
397+ ASSERT_FALSE (target.containsScratchPoint (-224.7 , 161.5 )); // [3.3, 3.5]
398398
399399 // Test colorAtScratchPoint()
400- ASSERT_EQ (target.colorAtScratchPoint (-227.5 , 165 ), 0 ); // [0, 0]
401- ASSERT_EQ (target.colorAtScratchPoint (-226.5 , 165 ), 0 ); // [1, 0]
402- ASSERT_EQ (target.colorAtScratchPoint (-225.5 , 165 ), 0 ); // [2, 0]
403- ASSERT_EQ (target.colorAtScratchPoint (-224.5 , 165 ), 0 ); // [3, 0]
404-
405- ASSERT_EQ (target.colorAtScratchPoint (-227.5 , 164 ), 0 ); // [0, 1]
406- ASSERT_EQ (target.colorAtScratchPoint (-226.5 , 164 ), 4278190335 ); // [1, 1]
407- ASSERT_EQ (target.colorAtScratchPoint (-226.1 , 163.75 ), 4278190335 ); // [1.4, 1.25]
408- ASSERT_EQ (target.colorAtScratchPoint (-225.5 , 164 ), 4294902015 ); // [2, 1]
409- ASSERT_EQ (target.colorAtScratchPoint (-224.5 , 164 ), 4294934656 ); // [3, 1]
410-
411- ASSERT_EQ (target.colorAtScratchPoint (-226.5 , 163 ), 4278190208 ); // [1, 2]
412- ASSERT_EQ (target.colorAtScratchPoint (-225.5 , 163 ), 0 ); // [2, 2]
413- ASSERT_EQ (target.colorAtScratchPoint (-224.5 , 163 ), 2505545047 ); // [3, 2]
414- ASSERT_EQ (target.colorAtScratchPoint (-224 , 162.9 ), 2505545047 ); // [3.5, 2.1]
415-
416- ASSERT_EQ (target.colorAtScratchPoint (-226.5 , 162 ), 4286578816 ); // [1, 3]
417- ASSERT_EQ (target.colorAtScratchPoint (-225.5 , 162 ), 4286611711 ); // [2, 3]
418- ASSERT_EQ (target.colorAtScratchPoint (-224.5 , 162 ), 4286611456 ); // [3, 3]
419- ASSERT_EQ (target.colorAtScratchPoint (-224.2 , 161.5 ), 4286611456 ); // [3.3, 3.5]
400+ ASSERT_EQ (target.colorAtScratchPoint (-228 , 165 ), 0 ); // [0, 0]
401+ ASSERT_EQ (target.colorAtScratchPoint (-227 , 165 ), 0 ); // [1, 0]
402+ ASSERT_EQ (target.colorAtScratchPoint (-226 , 165 ), 0 ); // [2, 0]
403+ ASSERT_EQ (target.colorAtScratchPoint (-225 , 165 ), 0 ); // [3, 0]
404+
405+ ASSERT_EQ (target.colorAtScratchPoint (-228 , 164 ), 0 ); // [0, 1]
406+ ASSERT_EQ (target.colorAtScratchPoint (-227 , 164 ), 4278190335 ); // [1, 1]
407+ ASSERT_EQ (target.colorAtScratchPoint (-226.6 , 163.75 ), 4278190335 ); // [1.4, 1.25]
408+ ASSERT_EQ (target.colorAtScratchPoint (-226 , 164 ), 4294902015 ); // [2, 1]
409+ ASSERT_EQ (target.colorAtScratchPoint (-225 , 164 ), 4294934656 ); // [3, 1]
410+
411+ ASSERT_EQ (target.colorAtScratchPoint (-227 , 163 ), 4278190208 ); // [1, 2]
412+ ASSERT_EQ (target.colorAtScratchPoint (-226 , 163 ), 0 ); // [2, 2]
413+ ASSERT_EQ (target.colorAtScratchPoint (-225 , 163 ), 2505545047 ); // [3, 2]
414+ ASSERT_EQ (target.colorAtScratchPoint (-224.5 , 162.9 ), 2505545047 ); // [3.5, 2.1]
415+
416+ ASSERT_EQ (target.colorAtScratchPoint (-227 , 162 ), 4286578816 ); // [1, 3]
417+ ASSERT_EQ (target.colorAtScratchPoint (-226 , 162 ), 4286611711 ); // [2, 3]
418+ ASSERT_EQ (target.colorAtScratchPoint (-225 , 162 ), 4286611456 ); // [3, 3]
419+ ASSERT_EQ (target.colorAtScratchPoint (-224.7 , 161.5 ), 4286611456 ); // [3.3, 3.5]
420420
421421 // Cleanup
422422 context.doneCurrent ();
0 commit comments