Skip to content

Commit 672e9ad

Browse files
committed
Refined kotlin sheet logic and updated screenshots on Linux
1 parent 6ba5b56 commit 672e9ad

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed
5.65 KB
Loading
4.93 KB
Loading

scripts/hellocodenameone/common/src/main/kotlin/com/codenameone/examples/hellocodenameone/tests/KotlinUiTest.kt

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ package com.codenameone.examples.hellocodenameone.tests
33
import com.codename1.components.Accordion
44
import com.codename1.components.MultiButton
55
import com.codename1.components.Switch
6-
import com.codename1.ui.Button
7-
import com.codename1.ui.CheckBox
8-
import com.codename1.ui.Container
9-
import com.codename1.ui.Label
10-
import com.codename1.ui.Sheet
11-
import com.codename1.ui.Slider
12-
import com.codename1.ui.TextArea
13-
import com.codename1.ui.TextField
6+
import com.codename1.testing.TestUtils
7+
import com.codename1.ui.*
148
import com.codename1.ui.layouts.BoxLayout
15-
import com.codename1.ui.util.UITimer
9+
import java.util.concurrent.CountDownLatch
1610

1711
class KotlinUiTest : BaseTest() {
1812
override fun runTest(): Boolean {
19-
val kotlinForm = createForm("Kotlin", BoxLayout.y(), "kotlin")
13+
val latch = CountDownLatch(1)
14+
val kotlinForm = object : Form("Kotlin", BoxLayout.y()) {
15+
override fun onShowCompleted() {
16+
super.onShowCompleted()
17+
latch.countDown()
18+
}
19+
}
2020
kotlinForm.addAll(
2121
Label("Kotlin UI Test Components"),
2222
Button("Kotlin Button"),
@@ -58,6 +58,16 @@ class KotlinUiTest : BaseTest() {
5858
sheet.contentPane.add(Label("This is a sheet covering part of the screen"))
5959
sheet.show(0)
6060

61+
var timeout = 100;
62+
while (sheet.parent == null && latch.count > 0) {
63+
TestUtils.waitFor(10)
64+
timeout--
65+
TestUtils.assertNotEqual(0, timeout)
66+
}
67+
68+
Cn1ssDeviceRunnerHelper.emitCurrentFormScreenshot("kotlin")
69+
done()
70+
6171
return true
6272
}
6373
}

0 commit comments

Comments
 (0)