@@ -190,23 +190,17 @@ TEST(TargetTest, Costumes)
190190 auto c3 = std::make_shared<Costume>(" costume3" , " " , " svg" );
191191
192192 TargetMock target;
193- EXPECT_CALL (target, dataSource ()).Times (17 ).WillRepeatedly (Return (nullptr ));
193+ EXPECT_CALL (target, dataSource ()).Times (14 ).WillRepeatedly (Return (nullptr ));
194194
195195 ASSERT_EQ (target.addCostume (c1), 0 );
196196 ASSERT_EQ (target.addCostume (c2), 1 );
197197 ASSERT_EQ (target.addCostume (c3), 2 );
198198 ASSERT_EQ (target.addCostume (c2), 1 ); // add existing costume
199199
200- // TODO: Use shared_ptr for assets
201- // ASSERT_EQ(target.costumes(), std::vector<std::shared_ptr<Costume>>({ c1, c2, c3 }));
202- ASSERT_EQ (target.costumes ().size (), 3 );
203- ASSERT_EQ (target.costumes ()[0 ]->name (), c1->name ());
204- ASSERT_EQ (target.costumes ()[1 ]->name (), c2->name ());
205- ASSERT_EQ (target.costumes ()[2 ]->name (), c3->name ());
206-
207- ASSERT_EQ (target.costumeAt (0 )->name (), c1->name ());
208- ASSERT_EQ (target.costumeAt (1 )->name (), c2->name ());
209- ASSERT_EQ (target.costumeAt (2 )->name (), c3->name ());
200+ ASSERT_EQ (target.costumes (), std::vector<std::shared_ptr<Costume>>({ c1, c2, c3 }));
201+ ASSERT_EQ (target.costumeAt (0 ), c1);
202+ ASSERT_EQ (target.costumeAt (1 ), c2);
203+ ASSERT_EQ (target.costumeAt (2 ), c3);
210204 ASSERT_EQ (target.costumeAt (3 ), nullptr );
211205 ASSERT_EQ (target.costumeAt (-1 ), nullptr );
212206
@@ -223,21 +217,17 @@ TEST(TargetTest, Costumes)
223217 ASSERT_TRUE (target.costumes ().empty ());
224218
225219 TargetMock target2;
226- EXPECT_CALL (target2, dataSource ()).Times (18 ).WillRepeatedly (Return (&source));
220+ EXPECT_CALL (target2, dataSource ()).Times (15 ).WillRepeatedly (Return (&source));
227221
228222 ASSERT_EQ (target2.addCostume (c1), 0 );
229223 ASSERT_EQ (target2.addCostume (c2), 1 );
230224 ASSERT_EQ (target2.addCostume (c3), 2 );
231225 ASSERT_EQ (target2.addCostume (c2), 1 ); // add existing costume
232226
233- ASSERT_EQ (target2.costumes ().size (), 3 );
234- ASSERT_EQ (target2.costumes ()[0 ]->name (), c1->name ());
235- ASSERT_EQ (target2.costumes ()[1 ]->name (), c2->name ());
236- ASSERT_EQ (target2.costumes ()[2 ]->name (), c3->name ());
237-
238- ASSERT_EQ (target2.costumeAt (0 )->name (), c1->name ());
239- ASSERT_EQ (target2.costumeAt (1 )->name (), c2->name ());
240- ASSERT_EQ (target2.costumeAt (2 )->name (), c3->name ());
227+ ASSERT_EQ (target2.costumes (), std::vector<std::shared_ptr<Costume>>({ c1, c2, c3 }));
228+ ASSERT_EQ (target2.costumeAt (0 ), c1);
229+ ASSERT_EQ (target2.costumeAt (1 ), c2);
230+ ASSERT_EQ (target2.costumeAt (2 ), c3);
241231 ASSERT_EQ (target2.costumeAt (3 ), nullptr );
242232 ASSERT_EQ (target2.costumeAt (-1 ), nullptr );
243233
@@ -254,16 +244,11 @@ TEST(TargetTest, Costumes)
254244 EXPECT_CALL (target2, dataSource ()).WillOnce (Return (&source));
255245 ASSERT_EQ (target2.costumes (), source.costumes ());
256246
257- ASSERT_EQ (source.costumes ().size (), 4 );
258- ASSERT_EQ (source.costumes ()[0 ]->name (), c1->name ());
259- ASSERT_EQ (source.costumes ()[1 ]->name (), c2->name ());
260- ASSERT_EQ (source.costumes ()[2 ]->name (), c3->name ());
261- ASSERT_EQ (source.costumes ()[3 ]->name (), c4->name ());
262-
263- ASSERT_EQ (source.costumeAt (0 )->name (), c1->name ());
264- ASSERT_EQ (source.costumeAt (1 )->name (), c2->name ());
265- ASSERT_EQ (source.costumeAt (2 )->name (), c3->name ());
266- ASSERT_EQ (source.costumeAt (3 )->name (), c4->name ());
247+ ASSERT_EQ (source.costumes (), std::vector<std::shared_ptr<Costume>>({ c1, c2, c3, c4 }));
248+ ASSERT_EQ (source.costumeAt (0 ), c1);
249+ ASSERT_EQ (source.costumeAt (1 ), c2);
250+ ASSERT_EQ (source.costumeAt (2 ), c3);
251+ ASSERT_EQ (source.costumeAt (3 ), c4);
267252 ASSERT_EQ (source.costumeAt (4 ), nullptr );
268253 ASSERT_EQ (source.costumeAt (-1 ), nullptr );
269254
@@ -281,23 +266,17 @@ TEST(TargetTest, Sounds)
281266 auto s3 = std::make_shared<Sound>(" sound3" , " " , " mp3" );
282267
283268 TargetMock target;
284- EXPECT_CALL (target, dataSource ()).Times (17 ).WillRepeatedly (Return (nullptr ));
269+ EXPECT_CALL (target, dataSource ()).Times (14 ).WillRepeatedly (Return (nullptr ));
285270
286271 ASSERT_EQ (target.addSound (s1), 0 );
287272 ASSERT_EQ (target.addSound (s2), 1 );
288273 ASSERT_EQ (target.addSound (s3), 2 );
289274 ASSERT_EQ (target.addSound (s2), 1 ); // add existing Sound
290275
291- // TODO: Use shared_ptr for assets
292- // ASSERT_EQ(target.sounds(), std::vector<std::shared_ptr<Sound>>({ s1, s2, s3 }));
293- ASSERT_EQ (target.sounds ().size (), 3 );
294- ASSERT_EQ (target.sounds ()[0 ]->name (), s1->name ());
295- ASSERT_EQ (target.sounds ()[1 ]->name (), s2->name ());
296- ASSERT_EQ (target.sounds ()[2 ]->name (), s3->name ());
297-
298- ASSERT_EQ (target.soundAt (0 )->name (), s1->name ());
299- ASSERT_EQ (target.soundAt (1 )->name (), s2->name ());
300- ASSERT_EQ (target.soundAt (2 )->name (), s3->name ());
276+ ASSERT_EQ (target.sounds (), std::vector<std::shared_ptr<Sound>>({ s1, s2, s3 }));
277+ ASSERT_EQ (target.soundAt (0 ), s1);
278+ ASSERT_EQ (target.soundAt (1 ), s2);
279+ ASSERT_EQ (target.soundAt (2 ), s3);
301280 ASSERT_EQ (target.soundAt (3 ), nullptr );
302281 ASSERT_EQ (target.soundAt (-1 ), nullptr );
303282
@@ -314,21 +293,17 @@ TEST(TargetTest, Sounds)
314293 ASSERT_TRUE (target.sounds ().empty ());
315294
316295 TargetMock target2;
317- EXPECT_CALL (target2, dataSource ()).Times (18 ).WillRepeatedly (Return (&source));
296+ EXPECT_CALL (target2, dataSource ()).Times (15 ).WillRepeatedly (Return (&source));
318297
319298 ASSERT_EQ (target2.addSound (s1), 0 );
320299 ASSERT_EQ (target2.addSound (s2), 1 );
321300 ASSERT_EQ (target2.addSound (s3), 2 );
322301 ASSERT_EQ (target2.addSound (s2), 1 ); // add existing Sound
323302
324- ASSERT_EQ (target2.sounds ().size (), 3 );
325- ASSERT_EQ (target2.sounds ()[0 ]->name (), s1->name ());
326- ASSERT_EQ (target2.sounds ()[1 ]->name (), s2->name ());
327- ASSERT_EQ (target2.sounds ()[2 ]->name (), s3->name ());
328-
329- ASSERT_EQ (target2.soundAt (0 )->name (), s1->name ());
330- ASSERT_EQ (target2.soundAt (1 )->name (), s2->name ());
331- ASSERT_EQ (target2.soundAt (2 )->name (), s3->name ());
303+ ASSERT_EQ (target2.sounds (), std::vector<std::shared_ptr<Sound>>({ s1, s2, s3 }));
304+ ASSERT_EQ (target2.soundAt (0 ), s1);
305+ ASSERT_EQ (target2.soundAt (1 ), s2);
306+ ASSERT_EQ (target2.soundAt (2 ), s3);
332307 ASSERT_EQ (target2.soundAt (3 ), nullptr );
333308 ASSERT_EQ (target2.soundAt (-1 ), nullptr );
334309
@@ -345,16 +320,11 @@ TEST(TargetTest, Sounds)
345320 EXPECT_CALL (target2, dataSource ()).WillOnce (Return (&source));
346321 ASSERT_EQ (target2.sounds (), source.sounds ());
347322
348- ASSERT_EQ (source.sounds ().size (), 4 );
349- ASSERT_EQ (source.sounds ()[0 ]->name (), s1->name ());
350- ASSERT_EQ (source.sounds ()[1 ]->name (), s2->name ());
351- ASSERT_EQ (source.sounds ()[2 ]->name (), s3->name ());
352- ASSERT_EQ (source.sounds ()[3 ]->name (), s4->name ());
353-
354- ASSERT_EQ (source.soundAt (0 )->name (), s1->name ());
355- ASSERT_EQ (source.soundAt (1 )->name (), s2->name ());
356- ASSERT_EQ (source.soundAt (2 )->name (), s3->name ());
357- ASSERT_EQ (source.soundAt (3 )->name (), s4->name ());
323+ ASSERT_EQ (source.sounds (), std::vector<std::shared_ptr<Sound>>({ s1, s2, s3, s4 }));
324+ ASSERT_EQ (source.soundAt (0 ), s1);
325+ ASSERT_EQ (source.soundAt (1 ), s2);
326+ ASSERT_EQ (source.soundAt (2 ), s3);
327+ ASSERT_EQ (source.soundAt (3 ), s4);
358328 ASSERT_EQ (source.soundAt (4 ), nullptr );
359329 ASSERT_EQ (source.soundAt (-1 ), nullptr );
360330
0 commit comments