summaryrefslogtreecommitdiffstats
path: root/tests/interactive/test-title.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/test-title.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/test-title.js')
-rwxr-xr-xtests/interactive/test-title.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/interactive/test-title.js b/tests/interactive/test-title.js
new file mode 100755
index 0000000..0a468dd
--- /dev/null
+++ b/tests/interactive/test-title.js
@@ -0,0 +1,37 @@
+#!/usr/bin/env gjs
+
+imports.gi.versions.Gtk = '3.0';
+
+const { GLib, Gtk } = imports.gi;
+
+function nextTitle() {
+ let length = Math.random() * 20;
+ let str = '';
+
+ for (let i = 0; i < length; i++) {
+ // 97 == 'a'
+ str += String.fromCharCode(97 + Math.random() * 26);
+ }
+
+ return str;
+}
+
+function main() {
+ Gtk.init(null);
+
+ let win = new Gtk.Window({ title: nextTitle() });
+ win.connect('destroy', () => {
+ Gtk.main_quit();
+ });
+ win.present();
+
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, 5000, function() {
+ win.title = nextTitle();
+ return true;
+ });
+
+ Gtk.main();
+}
+
+main();
+