A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AlmasB/FXGL/commit/df925ca20 below:

added missing implementations in EmbeddedPaneWindow · AlmasB/FXGL@df925ca · GitHub

@@ -17,6 +17,7 @@ import javafx.event.EventHandler

17 17

import javafx.event.EventType

18 18

import javafx.scene.Parent

19 19

import javafx.scene.image.Image

20 +

import javafx.scene.layout.StackPane

20 21

import javafx.stage.Stage

21 22

import org.hamcrest.CoreMatchers.`is`

22 23

import org.hamcrest.CoreMatchers.not

@@ -37,22 +38,25 @@ class MainWindowTest {

37 38 38 39

companion object {

39 40 40 -

private lateinit var window: PrimaryStageWindow

41 +

private lateinit var window: MainWindow

41 42

private lateinit var stage: Stage

43 +

private lateinit var fxglPane: FXGLPane

42 44

private lateinit var scene: FXGLScene

43 45 46 +

private val settings = GameSettings()

47 + 44 48

private const val WIDTH = 600

45 49

private const val HEIGHT = 400

46 50 47 51

@BeforeAll

48 52

@JvmStatic fun before() {

49 53

Async.startAsyncFX {

50 - 51 -

val settings = GameSettings()

52 54

settings.width = WIDTH

53 55

settings.height = HEIGHT

54 56 55 57

stage = Stage()

58 +

fxglPane = FXGLPane(WIDTH.toDouble(), HEIGHT.toDouble())

59 + 56 60

scene = object : FXGLScene(WIDTH, HEIGHT) {}

57 61 58 62

window = PrimaryStageWindow(stage, scene, settings.toReadOnly())

@@ -61,7 +65,7 @@ class MainWindowTest {

61 65

}

62 66 63 67

@Test

64 -

@EnabledIfEnvironmentVariable(named = "CI", matches = "true")

68 +

//@EnabledIfEnvironmentVariable(named = "CI", matches = "true")

65 69

fun runTests() {

66 70

var count = 0

67 71

@@ -79,6 +83,22 @@ class MainWindowTest {

79 83

}.await()

80 84 81 85

assertThat(count, `is`(1))

86 + 87 +

Async.startAsyncFX {

88 +

window = EmbeddedPaneWindow(fxglPane, scene, settings.toReadOnly())

89 +

stage.scene = javafx.scene.Scene(StackPane(fxglPane))

90 +

stage.icons.clear()

91 + 92 +

`Add icon`()

93 +

`Show Window`()

94 +

`Set scene`()

95 +

`Take screenshot`()

96 +

`Push and pop subscene`()

97 + 98 +

count++

99 +

}.await()

100 + 101 +

assertThat(count, `is`(2))

82 102

}

83 103 84 104

fun `Add icon`() {

@@ -103,13 +123,17 @@ class MainWindowTest {

103 123

fun `Show Window`() {

104 124

window.show()

105 125 106 -

assertThat(window.stage, `is`(stage))

126 +

if (window is PrimaryStageWindow) {

127 +

assertThat((window as PrimaryStageWindow).stage, `is`(stage))

128 +

assertThat(stage.scene.root, `is`<Parent>(scene.root))

129 +

} else {

130 +

assertThat((window as EmbeddedPaneWindow).fxglPane, `is`(fxglPane))

131 +

assertThat(stage.scene, `is`(fxglPane.scene))

132 +

}

107 133 108 134

assertTrue(stage.isShowing, "Window is not showing")

109 135

assertTrue(stage.width >= WIDTH, "Window is not at least $WIDTH wide")

110 136

assertTrue(stage.height >= HEIGHT, "Window is not at least $HEIGHT high")

111 - 112 -

assertThat(stage.scene.root, `is`<Parent>(scene.root))

113 137

}

114 138 115 139

/**

@@ -151,8 +175,6 @@ class MainWindowTest {

151 175

val filterConsume = EventHandler<Event> {

152 176

count -= 5

153 177

it.consume()

154 - 155 -

println(it.isConsumed)

156 178

}

157 179 158 180

scene.input.addEventFilter(EventType.ROOT, filterConsume)

@@ -168,7 +190,7 @@ class MainWindowTest {

168 190 169 191

window.setScene(scene2)

170 192 171 -

assertThat(stage.scene.root, `is`<Parent>(scene2.root))

193 +

assertThat(stage.scene, `is`(scene2.root.scene))

172 194

}

173 195 174 196

fun `Take screenshot`() {


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