gnome-shell/tests/interactive/box-layout.js
Owen W. Taylor 55497899dd Add some structure for interactive tests of UI components
js/ui/environment.js: Split out initial UI setup (Tweener initialization,
  ClutterContainer monkey-patching) into a separate file we can import from tests.

tests/: Directory for various types of tests
tests/run-test.sh: Shell script that to run tests with an appropriate
  environment set up.

tests/testcommon/: Common modules and data for tests
tests/interactive/: Interactive tests

tests/interactive/box-layout.js: A sample test of StLayout

https://bugzilla.gnome.org/show_bug.cgi?id=595987
2009-10-01 14:41:17 -04:00

40 lines
1.0 KiB
JavaScript

/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
const UI = imports.testcommon.ui;
UI.init();
let stage = Clutter.Stage.get_default();
let b = new St.BoxLayout({ vertical: true,
width: stage.width,
height: stage.height });
stage.add_actor(b);
let b2 = new St.BoxLayout();
b.add(b2, { expand: true, fill: true });
let r1 = new St.BoxLayout({ style_class: 'red',
width: 10,
height: 10 });
b2.add(r1, { expand: true });
let r2 = new St.BoxLayout({ style_class: 'green',
width: 10,
height: 10 });
b2.add(r2, { expand: true,
x_fill: false,
x_align: St.Align.MIDDLE,
y_fill: false,
y_align: St.Align.MIDDLE });
let r3 = new St.BoxLayout({ style_class: 'blue',
width: 10,
height: 10 });
b.add(r3);
stage.show();
Clutter.main();