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
This commit is contained in:
Adel Gadllah 2011-09-16 21:03:26 +02:00
parent 09fe12d0c1
commit 247ad9d7ab

View File

@ -325,10 +325,52 @@ mainBox.add(fadeBox);
spacer = new St.Bin(); spacer = new St.Bin();
fadeBox.add(spacer, { expand: true }); 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: '})); fadeBox.add(new St.Label({ text: 'Vertical Fade: '}));
let vfade = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;' }); let vfade = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;' });
fadeBox.add(vfade); 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) { function toggleFade(button) {
switch(button.label) { switch(button.label) {
case 'No': case 'No':