-
Notifications
You must be signed in to change notification settings - Fork 1
/
render.js
76 lines (67 loc) · 1.89 KB
/
render.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
* Created by henrikrudstrom on 29.02.16.
*/
var fs = require('fs');
var execFile = require("child_process").execFileSync;
var exec = require("child_process").execSync;
var glob = require("glob");
var devPath = __dirname.split("/").pop();
var loader = "dev/loader.qml";
var paths = [
"tests/Tests/qml/*.qml",
//"tests/Tests/SimpleRenderTest.qml"
];
function isRenderTest(file, callback) {
var lineReader = require('readline').createInterface({
input: require('fs').createReadStream(file)
});
lineReader.on('line', function(line) {
if (line.indexOf("@Render") != -1) {
callback();
}
lineReader.close();
});
}
if(process.argv.length == 2){
paths.forEach(function(paths) {
glob(paths, function(er, files) {
files.forEach(function(file) {
console.log("Rendering " + file)
render(file);
});
});
// glob("tests/**/*.qml", function(er, files) {
// files.forEach(function(file) {
// isRenderTest(file, function() { render(file); });
// });
// });
});
} else if (process.argv.length == 3){
render(process.argv[2])
}
function render(path) {
//console.log(path);
var png = path.replace(".qml", ".png");
execRender(devPath + "/bin/qtqmltest", loader, path);
exec("sleep 1")
// try {
// fs.accessSync(png, fs.F_OK);
// } catch (e) {
// exec(devPath + "/bin/shorty", [devPath + "/simple_screenshot.qml", path]);
// }
// console.log(cwd)
// console.log(devPath + "/bin/shorty")
//
// var files = [devPath + loader , devPath + path.replace("/", "\\")]
// console.log(files)
// execAsync(devPath + "\\bin\\shorty", files, function(err, stdout, stderr){
// console.log(err);
// console.log(stdout);
// console.log(stderr);
// });
//console.log(output.toString('ascii'))
}
function execRender(shorty, loader, file){
console.log(shorty, loader, file)
execFile(shorty, [loader, file]);
}