Skip to content

Commit

Permalink
WIP [#22]
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Desautels committed Apr 15, 2011
1 parent babbddc commit 04dc664
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
7 changes: 5 additions & 2 deletions resources/tests.json
@@ -1,5 +1,6 @@
{
"testSuite": [{
"blurRadius": "1",
"testSuite": [{
"dependancyURL": "resources/test_1.js",
"test": [{
"name": "Load test 1",
Expand All @@ -20,7 +21,7 @@
"run" : "function (canvas) { var gl = canvas.getContext('experimental-webgl'); gl.clearColor(0, 0, 0, 1); gl.clear(gl.COLOR_BUFFER_BIT); }"
}
}]
},{
},{
"dependancyURL": ["resources/test_2a.js", "resources/test_2b.js"],
"test": [{
"name": "Load test 3",
Expand Down Expand Up @@ -50,6 +51,7 @@
}
}]
},{
"blurRadius": "2",
"test": [{
"name": "Known Pass 1",
"firstCanvas": {
Expand All @@ -68,6 +70,7 @@
}
},{
"name": "Known Fail 1",
"blurRadius": "3",
"firstCanvas": {
"src" : { "url" : "resources/default3.png", "type" : "image"}
},
Expand Down
26 changes: 21 additions & 5 deletions sundae.js
Expand Up @@ -109,12 +109,12 @@ var sundae = {};
_pool.setup(_numWorkers);
getTests();
};
function reportResult(r,t){
r.innerHTML = t.name + ": [" + t.firstCanvas.time + "ms] vs " + "[" + t.secondCanvas.time + "ms]";
function reportResult(r,t,s){
r.innerHTML = t.name + ": [" + t.firstCanvas.time + "ms] vs " + "[" + t.secondCanvas.time + "ms]" + s;
if(t.note)
r.innerHTML += " - " + t.note;
}
function setupTest(test){
function setupTest(test, sig){
var name = test.name || "default";
var d = createDiv(_container, name);
var r = createDiv(d, name + "-title");
Expand All @@ -133,7 +133,7 @@ var sundae = {};
var whenDone = function(who){
isDone[who] = true;
if(isDone["first"] == true && isDone["second"] == true){
reportResult(r, test);
reportResult(r, test, sig);
var pix = {};
pix.a = getPixels(a, isWebgl(a));
pix.b = getPixels(b, isWebgl(b));
Expand Down Expand Up @@ -227,15 +227,31 @@ var sundae = {};
getScript(deps, callback);
}
};
var sbd, tbd;
var setupTests = function(tests){
for(var j = 0; j < tests.length; j++){
if(tests[j].blurRadius){
tbd = _sigma;
sundae.setBlurRadius(tests[j].blurRadius);
}
else
sundae.setBlurRadius(tbd);
if(_tag == "all" || (_tag != "all" && tests[j].tag && tests[j].tag == _tag))
setupTest(tests[j]);
setupTest(tests[j], _sigma);
}
};
var setupTestSuites = function(data){
if(data.blurRadius)
sundae.setBlurRadius(data.blurRadius);
sbd = tbd = _sigma;
if(data.testSuite){
for(var i = 0; i < data.testSuite.length; i++){
if(data.testSuite[i].blurRadius){
sbd = _sigma;
sundae.setBlurRadius(data.testSuite[i].blurRadius);
}
else
sundae.setBlurRadius(sbd);
if(data.testSuite[i].dependancyURL){
loadDeps(data.testSuite[i].dependancyURL,
function(tests){
Expand Down

0 comments on commit 04dc664

Please sign in to comment.