[gnome-shell] scroll-view-sizing: Add tests for padding / borders



commit 247ad9d7ab64f5f2ad00f46da8a15ca812cfaf61
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Fri Sep 16 21:03:26 2011 +0200

    scroll-view-sizing: Add tests for padding / borders
    
    Add tests to verify that the fade works fine with borders and
    padding.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=659159

 tests/interactive/scroll-view-sizing.js |   42 +++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/tests/interactive/scroll-view-sizing.js b/tests/interactive/scroll-view-sizing.js
index 249e0c3..e4dffa2 100644
--- a/tests/interactive/scroll-view-sizing.js
+++ b/tests/interactive/scroll-view-sizing.js
@@ -325,10 +325,52 @@ mainBox.add(fadeBox);
 spacer = new St.Bin();
 fadeBox.add(spacer, { expand: true });
 
+fadeBox.add(new St.Label({ text: 'Padding: '}));
+let paddingButton = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;padding-right:3px;' });
+fadeBox.add(paddingButton);
+
+fadeBox.add(new St.Label({ text: 'Borders: '}));
+let borderButton = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;padding-right:3px;' });
+fadeBox.add(borderButton);
+
 fadeBox.add(new St.Label({ text: 'Vertical Fade: '}));
 let vfade = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;' });
 fadeBox.add(vfade);
 
+function togglePadding(button) {
+    switch(button.label) {
+    case 'No':
+	button.label = 'Yes';
+	break;
+    case 'Yes':
+	button.label = 'No';
+	break;
+    }
+    if (scrollView.style == null)
+        scrollView.style = (button.label == 'Yes' ? 'padding: 10px;' : 'padding: 0;');
+    else
+        scrollView.style += (button.label == 'Yes' ? 'padding: 10px;' : 'padding: 0;');
+}
+
+paddingButton.connect('clicked', function() { togglePadding(paddingButton); });
+
+function toggleBorders(button) {
+    switch(button.label) {
+    case 'No':
+	button.label = 'Yes';
+	break;
+    case 'Yes':
+	button.label = 'No';
+	break;
+    }
+    if (scrollView.style == null)
+        scrollView.style = (button.label == 'Yes' ? 'border: 2px solid red;' : 'border: 0;');
+    else
+        scrollView.style += (button.label == 'Yes' ? 'border: 2px solid red;' : 'border: 0;');
+}
+
+borderButton.connect('clicked', function() { toggleBorders(borderButton); });
+
 function toggleFade(button) {
     switch(button.label) {
     case 'No':



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