From 247ad9d7ab64f5f2ad00f46da8a15ca812cfaf61 Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Fri, 16 Sep 2011 21:03:26 +0200 Subject: [PATCH] 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 file changed, 42 insertions(+) diff --git a/tests/interactive/scroll-view-sizing.js b/tests/interactive/scroll-view-sizing.js index 249e0c367..e4dffa24b 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':