Search in sources :

Example 16 with Force

use of com.b3dgs.lionengine.game.Force in project lionengine by b3dgs.

the class LaunchableConfigTest method testHashCode.

/**
 * Test hash code.
 */
@Test
void testHashCode() {
    final LaunchableConfig launchable = new LaunchableConfig("media", "sfx", 10, 1, 2, new Force(1.0, 2.0));
    assertHashEquals(launchable, launchable);
    assertHashEquals(launchable, new LaunchableConfig("media", "sfx", 10, 1, 2, new Force(1.0, 2.0)));
    assertHashNotEquals(launchable, new LaunchableConfig("", "sfx", 10, 1, 2, new Force(1.0, 2.0)));
    assertHashNotEquals(launchable, new LaunchableConfig("media", "", 10, 1, 2, new Force(1.0, 2.0)));
    assertHashNotEquals(launchable, new LaunchableConfig("media", "sfx", 0, 1, 2, new Force(1.0, 2.0)));
    assertHashNotEquals(launchable, new LaunchableConfig("media", "sfx", 10, 1, 2, new Force(2.0, 1.0)));
    assertHashNotEquals(launchable, new LaunchableConfig("media", "sfx", 10, 0, 2, new Force(1.0, 2.0)));
    assertHashNotEquals(launchable, new LaunchableConfig("media", "sfx", 10, 1, 0, new Force(1.0, 2.0)));
}
Also used : Force(com.b3dgs.lionengine.game.Force) Test(org.junit.jupiter.api.Test)

Example 17 with Force

use of com.b3dgs.lionengine.game.Force in project lionengine by b3dgs.

the class LaunchableConfigTest method testToString.

/**
 * Test to string.
 */
@Test
void testToString() {
    final LaunchableConfig launchable = new LaunchableConfig("media", "sfx", 10, 1, 2, new Force(1.0, 2.0));
    assertEquals("LaunchableConfig [media=media, sfx=sfx, delay=10, ox=1, oy=2, vector=" + "Force [fh=1.0, fv=2.0, velocity=0.0, sensibility=0.0]]", launchable.toString());
}
Also used : Force(com.b3dgs.lionengine.game.Force) Test(org.junit.jupiter.api.Test)

Example 18 with Force

use of com.b3dgs.lionengine.game.Force in project lionengine by b3dgs.

the class LauncherConfigTest method testToString.

/**
 * Test to string.
 */
@Test
void testToString() {
    final LaunchableConfig launchable = new LaunchableConfig("media", "sfx", 10, 1, 2, new Force(1.0, 2.0));
    final LauncherConfig launcher = new LauncherConfig(0, 1, true, Arrays.asList(launchable, launchable));
    assertEquals("LauncherConfig [level=0, delay=1, mirrorable=true, launchables=" + System.lineSeparator() + Constant.TAB + "LaunchableConfig [media=media, sfx=sfx, delay=10, ox=1, oy=2, vector=" + "Force [fh=1.0, fv=2.0, velocity=0.0, sensibility=0.0]]" + System.lineSeparator() + Constant.TAB + "LaunchableConfig [media=media, sfx=sfx, delay=10, ox=1, oy=2, vector=" + "Force [fh=1.0, fv=2.0, velocity=0.0, sensibility=0.0]]]", launcher.toString());
}
Also used : Force(com.b3dgs.lionengine.game.Force) Test(org.junit.jupiter.api.Test)

Example 19 with Force

use of com.b3dgs.lionengine.game.Force in project lionengine by b3dgs.

the class LauncherConfigTest method testEquals.

/**
 * Test equals.
 */
@Test
void testEquals() {
    final LaunchableConfig launchable = new LaunchableConfig("media", "sfx", 10, 1, 2, new Force(1.0, 2.0));
    final LauncherConfig launcher = new LauncherConfig(0, 1, false, Arrays.asList(launchable));
    assertEquals(launcher, launcher);
    assertNotEquals(launcher, null);
    assertNotEquals(launcher, new Object());
    assertNotEquals(launcher, new LauncherConfig(0, 0, false, Arrays.asList(launchable)));
    assertNotEquals(launcher, new LauncherConfig(0, 1, false, new ArrayList<LaunchableConfig>()));
    assertNotEquals(launcher, new LauncherConfig(1, 0, false, Arrays.asList(launchable)));
    assertNotEquals(launcher, new LauncherConfig(0, 0, true, Arrays.asList(launchable)));
    assertNotEquals(launcher, new LauncherConfig(0, 1, true, new ArrayList<LaunchableConfig>()));
    assertNotEquals(launcher, new LauncherConfig(1, 0, true, Arrays.asList(launchable)));
}
Also used : Force(com.b3dgs.lionengine.game.Force) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test)

Example 20 with Force

use of com.b3dgs.lionengine.game.Force in project lionengine by b3dgs.

the class LauncherConfigTest method testHashCode.

/**
 * Test hash code.
 */
@Test
void testHashCode() {
    final LaunchableConfig launchable = new LaunchableConfig("media", "sfx", 10, 1, 2, new Force(1.0, 2.0));
    final LauncherConfig launcher = new LauncherConfig(0, 1, false, Arrays.asList(launchable));
    assertHashEquals(launcher, launcher);
    assertHashEquals(launcher, new LauncherConfig(0, 1, false, Arrays.asList(launchable)));
    assertHashNotEquals(launcher, new LauncherConfig(0, 0, false, Arrays.asList(launchable)));
    assertHashNotEquals(launcher, new LauncherConfig(0, 1, false, new ArrayList<LaunchableConfig>()));
    assertHashNotEquals(launcher, new LauncherConfig(1, 0, false, Arrays.asList(launchable)));
    assertHashNotEquals(launcher, new LauncherConfig(0, 1, true, Arrays.asList(launchable)));
    assertHashNotEquals(launcher, new LauncherConfig(0, 0, true, Arrays.asList(launchable)));
    assertHashNotEquals(launcher, new LauncherConfig(0, 1, true, new ArrayList<LaunchableConfig>()));
    assertHashNotEquals(launcher, new LauncherConfig(1, 0, true, Arrays.asList(launchable)));
}
Also used : Force(com.b3dgs.lionengine.game.Force) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test)

Aggregations

Force (com.b3dgs.lionengine.game.Force)23 Test (org.junit.jupiter.api.Test)11 ArrayList (java.util.ArrayList)4 Media (com.b3dgs.lionengine.Media)3 Xml (com.b3dgs.lionengine.Xml)3 Test (org.junit.Test)3 Transformable (com.b3dgs.lionengine.game.feature.Transformable)2 TransformableModel (com.b3dgs.lionengine.game.feature.TransformableModel)2 Tile (com.b3dgs.lionengine.game.feature.tile.Tile)2 Configurer (com.b3dgs.lionengine.game.Configurer)1 Handler (com.b3dgs.lionengine.game.feature.Handler)1 IdentifiableModel (com.b3dgs.lionengine.game.feature.IdentifiableModel)1 Mirrorable (com.b3dgs.lionengine.game.feature.Mirrorable)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1