summaryrefslogtreecommitdiffstats
path: root/tests/interactive/entry.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:54:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:54:43 +0000
commite4283f6d48b98e764b988b43bbc86b9d52e6ec94 (patch)
treec8f7f7a6c2f5faa2942d27cefc6fd46cca492656 /tests/interactive/entry.js
parentInitial commit. (diff)
downloadgnome-shell-e4283f6d48b98e764b988b43bbc86b9d52e6ec94.tar.xz
gnome-shell-e4283f6d48b98e764b988b43bbc86b9d52e6ec94.zip
Adding upstream version 43.9.upstream/43.9upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/interactive/entry.js')
-rw-r--r--tests/interactive/entry.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/interactive/entry.js b/tests/interactive/entry.js
new file mode 100644
index 0000000..9ae0106
--- /dev/null
+++ b/tests/interactive/entry.js
@@ -0,0 +1,57 @@
+// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
+
+const UI = imports.testcommon.ui;
+
+const { Clutter, GLib, St } = imports.gi;
+
+function test() {
+ let stage = new Clutter.Stage({ width: 400, height: 400 });
+ UI.init(stage);
+
+ let vbox = new St.BoxLayout({ vertical: true,
+ width: stage.width,
+ height: stage.height,
+ style: 'padding: 10px; spacing: 10px; font: 32px sans-serif;' });
+ stage.add_actor(vbox);
+
+ let entry = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
+ text: 'Example text' });
+ vbox.add(entry,
+ { expand: true,
+ y_fill: false, y_align: St.Align.MIDDLE });
+ entry.grab_key_focus();
+
+ let entryTextHint = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
+ hint_text: 'Hint text' });
+ vbox.add(entryTextHint,
+ { expand: true,
+ y_fill: false, y_align: St.Align.MIDDLE });
+
+ let hintActor = new St.Label({ text: 'Hint actor' });
+ let entryHintActor = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
+ hint_actor: hintActor });
+ vbox.add(entryHintActor,
+ { expand: true,
+ y_fill: false, y_align: St.Align.MIDDLE });
+
+ let hintActor2 = new St.Label({ text: 'Hint both (actor)' });
+ let entryHintBoth = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
+ hint_actor: hintActor2 });
+ let idx = 0;
+ GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, function() {
+ idx++;
+
+ if (idx % 2 == 0)
+ entryHintBoth.hint_actor = hintActor2;
+ else
+ entryHintBoth.hint_text = 'Hint both (text)';
+
+ return true;
+ });
+ vbox.add(entryHintBoth,
+ { expand: true,
+ y_fill: false, y_align: St.Align.MIDDLE });
+
+ UI.main(stage);
+}
+test();