Scripting.createTestWindow(): take params

Take a parameter object rather than a long parameter list containing
multiple booleans.

https://bugzilla.gnome.org/show_bug.cgi?id=732349
This commit is contained in:
Owen W. Taylor 2014-05-19 21:00:01 -04:00
parent e375e1a857
commit f285f2c69f
2 changed files with 18 additions and 6 deletions

View File

@ -87,7 +87,10 @@ function run() {
yield Scripting.destroyTestWindows();
for (let k = 0; k < config.count; k++)
yield Scripting.createTestWindow(config.width, config.height, config.alpha, config.maximized);
yield Scripting.createTestWindow({ width: config.width,
height: config.height,
alpha: config.alpha,
maximized: config.maximized });
yield Scripting.waitTestWindows();
yield Scripting.sleep(1000);

View File

@ -7,6 +7,7 @@ const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const Main = imports.ui.main;
const Params = imports.misc.params;
// This module provides functionality for driving the shell user interface
// in an automated fashion. The primary current use case for this is
@ -99,9 +100,11 @@ function _getPerfHelper() {
/**
* createTestWindow:
* @width: width of window, in pixels
* @height: height of window, in pixels
* @alpha: whether the window should be alpha transparent
* @params: options for window creation.
* width - width of window, in pixels (default 640)
* height - height of window, in pixels (default 480)
* alpha - whether the window should have an alpha channel (default false)
* maximized - whether the window should be created maximized (default false)
* @maximized: whethe the window should be created maximized
*
* Creates a window using gnome-shell-perf-helper for testing purposes.
@ -110,11 +113,17 @@ function _getPerfHelper() {
* because of the normal X asynchronous mapping process, to actually wait
* until the window has been mapped and exposed, use waitTestWindows().
*/
function createTestWindow(width, height, alpha, maximized) {
function createTestWindow(width, height, params) {
params = Params.parse(params, { width: 640,
height: 480,
alpha: false,
maximized: false });
let cb;
let perfHelper = _getPerfHelper();
perfHelper.CreateWindowRemote(width, height, alpha, maximized,
perfHelper.CreateWindowRemote(params.width, params.height,
params.alpha, params.maximized,
function(result, excp) {
if (cb)
cb();