1
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
3
const Clutter = imports.gi.Clutter;
4
const St = imports.gi.St;
6
const UI = imports.testcommon.ui;
9
let stage = Clutter.Stage.get_default();
13
let vbox = new St.BoxLayout({ width: stage.width,
15
style: 'background: #ffee88;' });
16
stage.add_actor(vbox);
18
let scroll = new St.ScrollView();
19
vbox.add(scroll, { expand: true });
21
let vbox = new St.BoxLayout({ vertical: true,
22
style: 'padding: 10px;'
23
+ 'spacing: 20px;' });
24
scroll.add_actor(vbox);
28
function addTestCase(image, size, backgroundSize) {
29
let obin = new St.Bin({ style: 'border: 3px solid green;' });
32
let bin = new St.Bin({ style_class: 'background-image-' + image,
35
style: 'border: 1px solid transparent;'
36
+ 'background-size: ' + backgroundSize + ';',
42
bin.set_child(new St.Label({ text: backgroundSize,
43
style: 'font-size: 15px;'
44
+ 'text-align: center;'
48
function addTestLine(image, size, backgroundSizes) {
49
vbox.add(new St.Label({ text: image + '.svg / ' + size.width + '×' + size.height,
50
style: 'font-size: 15px;'
51
+ 'text-align: center;'
54
tbox = new St.BoxLayout({ style: 'spacing: 20px;' });
57
if (backgroundSizes.length == 2)
58
addTestCase(image, size, "auto");
59
for each (let s in backgroundSizes)
60
addTestCase(image, size, s);
63
let size1 = { width: 200, height: 200 }
64
let size2 = { width: 250, height: 250 }
65
let size3 = { width: 100, height: 100 }
68
addTestLine('200-200', size1, ["200px 200px", "100px 100px", "100px 200px"]);
71
addTestLine('200-200', size1, ["contain", "cover"]);
73
addTestLine('200-200', size2, ["contain", "cover"]);
75
addTestLine('200-200', size3, ["contain", "cover"]);
78
addTestLine('200-100', size1, ["contain", "cover"]);
79
addTestLine('200-100', size2, ["contain", "cover"]);
80
addTestLine('200-100', size3, ["contain", "cover"]);
83
addTestLine('100-200', size1, ["contain", "cover"]);
84
addTestLine('100-200', size2, ["contain", "cover"]);
85
addTestLine('100-200', size3, ["contain", "cover"]);