Failing test case for flx scene switch

This commit is contained in:
2023-03-08 07:56:24 -07:00
parent dc8851aa14
commit 29db732fa8
17 changed files with 42 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,39 @@
// When the sound device is non-functional, the FlxSound finish callback won't be called.
// Don't let that stop Hollywoo:
{(prop &mut soundPlayed false)(cc)}
(preload
(newFlxSound "pageFlip" AssetPaths.pageTurn__wav))
{(delay 1 ->:Void (assert soundPlayed)) (cc)}
AWAITPLAYSOUND "pageFlip"
{(set soundPlayed true) (cc)}
// Through scene transitions, set background sprites need to maintain the same size.
(defMacro makeSetAndScene [asset]
`(preload
(newFlxSet ,asset ,asset)
(newSceneFromSet ,asset ,asset Day Exterior)))
(var basicSceneKey AssetPaths.whiteBackground1280x720__png)
(makeSetAndScene basicSceneKey)
(prop &mut sk "")
(prop &mut firstWidth 0.0)
(prop &mut firstHeight 0.0)
(defMacro testSetBackground [asset]
`(commands
(makeSetAndScene ,asset)
{(set sk ,asset) (cc)}
SETSCENE sk
(withSceneSet sk set
(assert (or (= FlxG.width set.width) (= FlxG.height set.height)))
(set firstWidth set.width)
(set firstHeight set.height))
SETSCENE basicSceneKey
SETSCENE sk
(withSceneSet sk set
(assert (and (= firstWidth set.width) (= firstHeight set.height))))))
(testSetBackground AssetPaths.grayBackground1280x720__png)
(testSetBackground AssetPaths.grayBackground1000x720__png)
(testSetBackground AssetPaths.grayBackground1280x580__png)
(Sys.exit 0)

View File

@@ -0,0 +1,3 @@
#! /bin/bash
(cd src/test && haxelib run lime test cpp -debug)

View File

@@ -1,8 +0,0 @@
{(prop &mut soundPlayed false)(cc)}
(preload
(newFlxSound "pageFlip" AssetPaths.pageTurn__wav))
{(delay 1 ->:Void (assert soundPlayed)) (cc)}
AWAITPLAYSOUND "pageFlip"
{(set soundPlayed true) (cc)}
(Sys.exit 0)