forked from xml3d/xml3d.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buffer-sharing.js
44 lines (38 loc) · 1.35 KB
/
buffer-sharing.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
module("Buffer Sharing tests", {
setup : function() {
stop();
var that = this;
this.cb = function(e) {
ok(true, "Scene loaded");
that.doc = document.getElementById("xml3dframe").contentDocument;
start();
};
loadDocument("scenes/buffer-sharing.xhtml"+window.location.search, this.cb);
},
teardown : function() {
var v = document.getElementById("xml3dframe");
v.removeEventListener("load", this.cb, true);
}
});
test("Cross Buffer Sharing", 3, function() {
var xTest = this.doc.getElementById("xml3dScene1"),
glTest = getContextForXml3DElement(xTest), hTest = getHandler(xTest),
xRef = this.doc.getElementById("xml3dScene2"), hRef = getHandler(xRef);
var self = this;
var testStep = 0;
function onFrameDrawn(){
if(testStep == 0){
if( XML3DUnit.getPixelValue(glTest, 100, 150)[0] == 0)
return;
XML3DUnit.loadSceneTestImages(self.doc, "xml3dScene1", "xml3dScene2", function(refImage, testImage){
QUnit.imageEqual(refImage, testImage, "Cross Content Sharing Scenes rendered identical");
testStep++;
start();
});
}
}
xTest.addEventListener("framedrawn", onFrameDrawn);
hRef.draw();
hTest.draw();
stop();
});