-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathxrandrSettingsHandlerTests.js
More file actions
60 lines (49 loc) · 2.02 KB
/
xrandrSettingsHandlerTests.js
File metadata and controls
60 lines (49 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* GPII Xrandr Settings Handler Tests
*
* Copyright 2013 Emergya
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* You may obtain a copy of the License at
* https://github.com/GPII/linux/blob/master/LICENSE.txt
*
* The research leading to these results has received funding from the European Union's
* Seventh Framework Programme (FP7/2007-2013)
* under grant agreement no. 289016.
*/
"use strict";
var fluid = require("gpii-universal"),
jqUnit = fluid.require("node-jqunit");
require("xrandr");
var xrandr = fluid.registerNamespace("gpii.xrandr");
jqUnit.module("GPII Xrandr Module");
jqUnit.test("Running tests for Xrandr Bridge", function () {
// Check if all required methods are available through the
// Xrandr Settings Handler.
//
var methods = ["getScreenResolution", "setScreenResolution", "get", "set"];
for (var method in methods) {
jqUnit.assertTrue("Checking availability of method '" + method + "'",
(methods[method] in xrandr));
}
var payload = {
"org.freedesktop.xrandr": [{
settings: {
"screen-resolution": {"width": 800, "height": 600}
}
}]
};
var returnPayload = xrandr.set(payload);
jqUnit.assertDeepEq("The resolution is being setted well",
returnPayload["org.freedesktop.xrandr"][0].settings["screen-resolution"].newValue,
payload["org.freedesktop.xrandr"][0].settings["screen-resolution"]);
var newPayload = fluid.copy(payload);
newPayload["org.freedesktop.xrandr"][0].settings["screen-resolution"] =
returnPayload["org.freedesktop.xrandr"][0].settings["screen-resolution"].oldValue;
var lastPayload = xrandr.set(newPayload);
jqUnit.assertDeepEq("The resolution is being restored well",
returnPayload["org.freedesktop.xrandr"][0].settings["screen-resolution"].oldValue,
lastPayload["org.freedesktop.xrandr"][0].settings["screen-resolution"].newValue);
});