gnome-shell/tests/interactive/box-layout.js
Owen W. Taylor d8d7f5f711 Add some structure for interactive tests of UI components
js/ui/environment.js: Split out initial UI setup (Tweener initialization,
  Nbtk 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 NbtkLayout
2009-09-18 16:18:50 -04:00

40 lines
1.1 KiB
JavaScript

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