[gnome-shell] tests/entry: add interactive tests for entry hints



commit 47b109d25bbc2633c17aa2dd783b3566c6817e5c
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Jun 6 17:39:34 2017 -0700

    tests/entry: add interactive tests for entry hints
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783484

 tests/interactive/entry.js |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/tests/interactive/entry.js b/tests/interactive/entry.js
index f17179d..4d8229a 100644
--- a/tests/interactive/entry.js
+++ b/tests/interactive/entry.js
@@ -4,6 +4,7 @@ const UI = imports.testcommon.ui;
 
 const Clutter = imports.gi.Clutter;
 const Lang = imports.lang;
+const Mainloop = imports.mainloop;
 const St = imports.gi.St;
 
 function test() {
@@ -23,6 +24,37 @@ function test() {
                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;
+    Mainloop.timeout_add_seconds(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();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]