From 0bccfe3bb9e60696b2880c94d619c8fea9cde2c1 Mon Sep 17 00:00:00 2001 From: George FunBook Date: Sun, 21 Apr 2024 16:22:01 -0400 Subject: [PATCH] add FlxContainer test --- .../unit/src/flixel/group/FlxContainerTest.hx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/unit/src/flixel/group/FlxContainerTest.hx b/tests/unit/src/flixel/group/FlxContainerTest.hx index 7ec95f4f65..248b71c3e5 100644 --- a/tests/unit/src/flixel/group/FlxContainerTest.hx +++ b/tests/unit/src/flixel/group/FlxContainerTest.hx @@ -2,6 +2,7 @@ package flixel.group; import flixel.FlxBasic; +import flixel.group.FlxContainer; import massive.munit.Assert; class FlxContainerTest extends FlxGroupTest @@ -15,4 +16,27 @@ class FlxContainerTest extends FlxGroupTest } return group; } + + @Test + function testMemberCameras() + { + final subGroup1 = new FlxContainer(); + group.add(subGroup1); + final subGroup2 = new FlxTypedContainer(); + subGroup1.add(subGroup2); + final member1 = new FlxSprite(); + final member2 = new FlxSprite(); + subGroup1.add(member1); + subGroup2.add(member2); + + final cam = new FlxCamera(); + group.camera = cam; + Assert.areEqual(cam, member1.getCameras()[0]); + Assert.areEqual(cam, member2.getCameras()[0]); + + final cams = [new FlxCamera()]; + group.cameras = cams; + Assert.areEqual(cams, member1.getCameras()); + Assert.areEqual(cams, member2.getCameras()); + } }