-
-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: replace bit flag with a boolean
- Loading branch information
Showing
2 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
fxgl-entity/src/test/kotlin/com/almasb/fxgl/physics/box2d/dynamics/BodyTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* FXGL - JavaFX Game Library. The MIT License (MIT). | ||
* Copyright (c) AlmasB ([email protected]). | ||
* See LICENSE for details. | ||
*/ | ||
|
||
package com.almasb.fxgl.physics.box2d.dynamics | ||
|
||
import com.almasb.fxgl.core.math.Vec2 | ||
import org.junit.jupiter.api.Assertions.* | ||
import org.junit.jupiter.api.Test | ||
|
||
/** | ||
* | ||
* @author Almas Baimagambetov ([email protected]) | ||
*/ | ||
class BodyTest { | ||
|
||
@Test | ||
fun `Body def sets body flags`() { | ||
val def = BodyDef() | ||
def.isActive = true | ||
def.isAllowSleep = true | ||
def.isBullet = true | ||
def.isFixedRotation = true | ||
def.isAwake = true | ||
|
||
val world = World(Vec2()) | ||
|
||
val body = Body(def, world) | ||
|
||
assertTrue(body.isActive) | ||
assertTrue(body.isSleepingAllowed) | ||
assertTrue(body.isBullet) | ||
assertTrue(body.isFixedRotation) | ||
assertTrue(body.isAwake) | ||
|
||
body.isActive = false | ||
body.isSleepingAllowed = false | ||
body.isBullet = false | ||
body.isFixedRotation = false | ||
body.isAwake = false | ||
|
||
assertFalse(body.isActive) | ||
assertFalse(body.isSleepingAllowed) | ||
assertFalse(body.isBullet) | ||
assertFalse(body.isFixedRotation) | ||
assertFalse(body.isAwake) | ||
} | ||
} |