@@ -154,15 +154,15 @@ TEST_F(RenderedTargetTest, UpdateMethods)
154
154
EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
155
155
EXPECT_CALL (engine, stageHeight ()).WillOnce (Return (360 ));
156
156
target.updateX (12.5 );
157
- ASSERT_EQ (target.x (), 275.5 );
157
+ ASSERT_EQ (target.x (), 276 );
158
158
ASSERT_EQ (target.y (), 108 );
159
159
160
160
// Y
161
161
EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
162
162
EXPECT_CALL (engine, stageHeight ()).WillOnce (Return (360 ));
163
163
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 );
166
166
167
167
// Size
168
168
EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
@@ -171,8 +171,8 @@ TEST_F(RenderedTargetTest, UpdateMethods)
171
171
target.beforeRedraw ();
172
172
ASSERT_EQ (target.width (), 4 );
173
173
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 );
176
176
ASSERT_EQ (target.transformOriginPoint ().x (), -23 );
177
177
ASSERT_EQ (target.transformOriginPoint ().y (), 72 );
178
178
@@ -187,26 +187,26 @@ TEST_F(RenderedTargetTest, UpdateMethods)
187
187
target.updateRotationStyle (Sprite::RotationStyle::LeftRight);
188
188
ASSERT_EQ (target.mirrorHorizontally (), false );
189
189
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 );
192
192
ASSERT_TRUE (mirrorHorizontallySpy.empty ());
193
193
194
194
EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
195
195
EXPECT_CALL (engine, stageHeight ()).WillOnce (Return (360 ));
196
196
target.updateDirection (-15 );
197
197
ASSERT_EQ (target.mirrorHorizontally (), true );
198
198
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 );
201
201
ASSERT_EQ (mirrorHorizontallySpy.count (), 1 );
202
202
203
203
EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
204
204
EXPECT_CALL (engine, stageHeight ()).WillOnce (Return (360 ));
205
205
target.updateDirection (134.89 );
206
206
ASSERT_EQ (target.mirrorHorizontally (), false );
207
207
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 );
210
210
ASSERT_EQ (mirrorHorizontallySpy.count (), 2 );
211
211
212
212
EXPECT_CALL (engine, stageWidth ()).WillOnce (Return (480 ));
@@ -223,8 +223,8 @@ TEST_F(RenderedTargetTest, UpdateMethods)
223
223
target.beforeRedraw ();
224
224
ASSERT_EQ (target.width (), 4 );
225
225
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 );
228
228
ASSERT_EQ (target.z (), 3 );
229
229
ASSERT_EQ (target.rotation (), 0 );
230
230
ASSERT_EQ (target.transformOriginPoint ().x (), -23 );
@@ -241,8 +241,8 @@ TEST_F(RenderedTargetTest, UpdateMethods)
241
241
target.beforeRedraw ();
242
242
ASSERT_EQ (target.width (), 4 );
243
243
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 );
246
246
ASSERT_EQ (target.transformOriginPoint ().x (), 0 );
247
247
ASSERT_EQ (target.transformOriginPoint ().y (), 0 );
248
248
ASSERT_EQ (target.transformOrigin (), QQuickItem::TopLeft);
@@ -263,8 +263,8 @@ TEST_F(RenderedTargetTest, UpdateMethods)
263
263
264
264
ASSERT_EQ (target.width (), 26 );
265
265
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 );
268
268
ASSERT_EQ (target.z (), 3 );
269
269
ASSERT_EQ (target.rotation (), 0 );
270
270
ASSERT_EQ (target.transformOriginPoint ().x (), 50 );
@@ -375,48 +375,48 @@ TEST_F(RenderedTargetTest, CpuRendering)
375
375
376
376
// Test containsScratchPoint()
377
377
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]
398
398
399
399
// 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]
420
420
421
421
// Cleanup
422
422
context.doneCurrent ();
0 commit comments