+43
-0
lines changedFilter options
+43
-0
lines changed Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
1
+
/*
2
+
* FXGL - JavaFX Game Library. The MIT License (MIT).
3
+
* Copyright (c) AlmasB (almaslvl@gmail.com).
4
+
* See LICENSE for details.
5
+
*/
6
+
7
+
package com.almasb.fxgl.dsl.components
8
+
9
+
import com.almasb.fxgl.entity.Entity
10
+
import javafx.geometry.Point2D
11
+
import org.hamcrest.CoreMatchers.`is`
12
+
import org.hamcrest.MatcherAssert.assertThat
13
+
import org.junit.jupiter.api.Assertions.assertFalse
14
+
import org.junit.jupiter.api.Assertions.assertTrue
15
+
import org.junit.jupiter.api.Test
16
+
17
+
/**
18
+
*
19
+
*
20
+
* @author Almas Baimagambetov (almaslvl@gmail.com)
21
+
*/
22
+
class WaypointMoveComponentTest {
23
+
24
+
@Test
25
+
fun `Moving via WaypointComponent`() {
26
+
val comp = WaypointMoveComponent(100.0, listOf(Point2D(20.0, 50.0), Point2D(40.0, 50.0)))
27
+
28
+
val e = Entity()
29
+
e.addComponent(comp)
30
+
31
+
assertFalse(comp.atDestinationProperty().value)
32
+
33
+
comp.onUpdate(5.0)
34
+
assertThat(e.position, `is`(Point2D(20.0, 50.0)))
35
+
36
+
assertFalse(comp.atDestinationProperty().value)
37
+
38
+
comp.onUpdate(5.0)
39
+
assertThat(e.position, `is`(Point2D(40.0, 50.0)))
40
+
41
+
assertTrue(comp.atDestinationProperty().value)
42
+
}
43
+
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4