diff --git a/tests/test_graphics_arraybuffer_bitDepths.js b/tests/test_graphics_arraybuffer_bitDepths.js index 2f37d6587..3408002ba 100644 --- a/tests/test_graphics_arraybuffer_bitDepths.js +++ b/tests/test_graphics_arraybuffer_bitDepths.js @@ -3,8 +3,10 @@ Graphics.prototype.dump = function(){ var n = 0; for (var y=0;y { console.log("Testing BPP ",bpp); - var g = Graphics.createArrayBuffer(32,8,bpp,{msb:true}); + var g = Graphics.createArrayBuffer(33,8,bpp,{msb:true}); if (E.getAddressOf(g.buffer)==0) throw new Error("Not a flat array! can't test properly"); + g.clearRect(); + g.setColor(1); var c = g.getColor(); g.drawLine(0,0,32,32); for (var i=0;i<8;i++) g.fillRect(9+i,i, 32-i,i); // test fillRect at different offsets - //if (bpp<=4) g.print(); +// if (bpp<=4) g.print(); - if (bpp==1 && btoa(g.buffer)!="gH///0A///8gH//+EA///AgH//gEA//wAgH/4AEA/8A=") { result = 0; print("Data stored wrong"); } - if (bpp==2 && btoa(g.buffer)!="wAA///////8wAA///////wwAA//////8AwAA//////AAwAA/////wAAwAA////8AAAwAA////AAAAwAA///wAA==") { result = 0; print("Data stored wrong"); } - if (bpp==4 && btoa(g.buffer)!="8AAAAA///////////////w8AAAAA//////////////8A8AAAAA/////////////wAA8AAAAA////////////AAAA8AAAAA//////////8AAAAA8AAAAA/////////wAAAAAA8AAAAA////////AAAAAAAA8AAAAA//////8AAAA=") { result = 0; print("Data stored wrong"); } - if (bpp==8 && btoa(g.buffer)!="/wAAAAAAAAAA//////////////////////////////8A/wAAAAAAAAAA/////////////////////////////wAA/wAAAAAAAAAA//////////////////////////8AAAAA/wAAAAAAAAAA////////////////////////AAAAAAAA/wAAAAAAAAAA/////////////////////wAAAAAAAAAA/wAAAAAAAAAA//////////////////8AAAAAAAAAAAAA/wAAAAAAAAAA////////////////AAAAAAAAAAAAAAAA/wAAAAAAAAAA/////////////wAAAAAAAA==") { result = 0; print("Data stored wrong"); } - if (bpp==16 && btoa(g.buffer)!="//8AAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////////////////////////////wAA//8AAAAAAAAAAAAAAAAAAAAA//////////////////////////////////////////////////////////8AAAAA//8AAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////////////////////wAAAAAAAAAA//8AAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////////////AAAAAAAAAAAAAAAA//8AAAAAAAAAAAAAAAAAAAAA//////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAA//8AAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAAAAAAAAAAAAAAAAAAAA////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAAAAAAAAAAAAAAAAAAAA//////////////////////////8AAAAAAAAAAAAAAAA=") { result = 0; print("Data stored wrong"); } - if (bpp==24 && btoa(g.buffer)!="////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////////////////////////////////////////////////////////AAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////////////////////////////////////////////////////AAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAA") { result = 0; print("Data stored wrong"); } + if (bpp==1 && btoa(g.buffer)!="gH///6Af//+IB///ggH//4CAf/+AIB//gAgH/4ACAf+A") { result = 0; print("Data stored wrong"); } + if (bpp==2 && btoa(g.buffer)!="QAAVVVVVVVVEAAFVVVVVVUBAABVVVVVVQAQAAVVVVVVAAEAAFVVVVUAABAABVVVVQAAAQAAVVVVAAAAEAAFVVUAA") { result = 0; print("Data stored wrong"); } + if (bpp==4 && btoa(g.buffer)!="EAAAAAERERERERERERERERAQAAAAAREREREREREREREQABAAAAABEREREREREREREAAAEAAAAAERERERERERERAAAAAQAAAAAREREREREREQAAAAABAAAAABEREREREREAAAAAAAEAAAAAERERERERAAAAAAAAAQAAAAAREREREQAAAA") { result = 0; print("Data stored wrong"); } + if (bpp==8 && btoa(g.buffer)!="AQAAAAAAAAAAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEAAAAAAAAAAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAAABAAAAAAAAAAABAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAAAAQAAAAAAAAAAAQEBAQEBAQEBAQEBAQEBAQEBAAAAAAAAAAEAAAAAAAAAAAEBAQEBAQEBAQEBAQEBAQEAAAAAAAAAAAABAAAAAAAAAAABAQEBAQEBAQEBAQEBAQAAAAAAAAAAAAAAAQAAAAAAAAAAAQEBAQEBAQEBAQEBAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAEBAQEBAQEBAQEAAAAAAAAA") { result = 0; print("Data stored wrong"); } + if (bpp==16 && btoa(g.buffer)!="AAEAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAA") { result = 0; print("Data stored wrong"); } + if (bpp==24 && btoa(g.buffer)!="AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA") { result = 0; print("Data stored wrong"); } //print(` if (bpp==${bpp} && btoa(g.buffer)!=${E.toJS(btoa(g.buffer))}) { result = 0; print("Data stored wrong"); }`);