summaryrefslogtreecommitdiffstats
path: root/tests/interactive/scrolling.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:07:22 +0000
commitf9d480cfe50ca1d7a0f0b5a2b8bb9932962bfbe7 (patch)
treece9e8db2d4e8799780fa72ae8f1953039373e2ee /tests/interactive/scrolling.js
parentInitial commit. (diff)
downloadgnome-shell-f9d480cfe50ca1d7a0f0b5a2b8bb9932962bfbe7.tar.xz
gnome-shell-f9d480cfe50ca1d7a0f0b5a2b8bb9932962bfbe7.zip
Adding upstream version 3.38.6.upstream/3.38.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/interactive/scrolling.js')
-rw-r--r--tests/interactive/scrolling.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/interactive/scrolling.js b/tests/interactive/scrolling.js
new file mode 100644
index 0000000..91951ce
--- /dev/null
+++ b/tests/interactive/scrolling.js
@@ -0,0 +1,51 @@
+// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
+
+const UI = imports.testcommon.ui;
+
+const { Clutter, Gtk, St } = imports.gi;
+
+function test() {
+ let stage = new Clutter.Stage();
+ UI.init(stage);
+
+ let vbox = new St.BoxLayout({ vertical: true,
+ width: stage.width,
+ height: stage.height,
+ style: "padding: 10px;" });
+ stage.add_actor(vbox);
+
+ let toggle = new St.Button({ label: 'Horizontal Scrolling',
+ toggle_mode: true });
+ vbox.add(toggle);
+
+ let v = new St.ScrollView();
+ vbox.add(v, { expand: true });
+
+ toggle.connect('notify::checked', () => {
+ v.set_policy(toggle.checked ? Gtk.PolicyType.AUTOMATIC
+ : Gtk.PolicyType.NEVER,
+ Gtk.PolicyType.AUTOMATIC);
+ });
+
+ let b = new St.BoxLayout({ vertical: true,
+ style: "border: 2px solid #880000; border-radius: 10px; padding: 0px 5px;" });
+ v.add_actor(b);
+
+ let cc_a = "a".charCodeAt(0);
+ let s = "";
+ for (let i = 0; i < 26 * 3; i++) {
+ s += String.fromCharCode(cc_a + i % 26);
+
+ let t = new St.Label({ text: s,
+ reactive: true });
+ let line = i + 1;
+ t.connect('button-press-event',
+ function() {
+ log("Click on line " + line);
+ });
+ b.add(t);
+ }
+
+ UI.main(stage);
+}
+test();