Skip to content

[WIP] Regression image tests #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png filter=lfs diff=lfs merge=lfs -text
Binary file modified logo/logo100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified logo/logo200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified logo/logo50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified logo/logo500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions pybloqs/static/jsinflate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 31 additions & 5 deletions pybloqs/static/uncompressed/jsinflate.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
(function(){
function decompress(bytes) {
const input = new ReadableStream({
start(c) {
c.enqueue(bytes);
c.close();
},
}).pipeThrough(new DecompressionStream("deflate"));

const reader = input.getReader();
const chunks = [];

return reader.read().then(function process({ done, value }) {
if (done) {
const decompressedData = new Uint8Array(
chunks.reduce((acc, chunk) => acc + chunk.length, 0)
);
let offset = 0;
chunks.forEach(chunk => {
decompressedData.set(chunk, offset);
offset += chunk.length;
});
return decompressedData;
}
chunks.push(value);
return reader.read().then(process);
});
}

var zip_inflate=async function(str){
const binaryString = atob(str);
var bytes = new Uint8Array(binaryString.length);
for (var i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return await new Response(
new Blob([bytes])
.stream()
.pipeThrough(new DecompressionStream('deflate'))
).text();
return decompress(bytes)
.then(decompressed => (new TextDecoder().decode(decompressed)))
.catch(console.error);
}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;}
)();
Binary file modified pybloqs_in_notebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/integration/generate/test_image_file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate'))).text();}
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
Expand Down Expand Up @@ -39,9 +41,13 @@
}
}
</style>
<style type="text/css">
html{color:red;}
</style>
</head>
<body>
<div class="pybloqs">
Some content
</div>
</body>
</html>
55 changes: 55 additions & 0 deletions tests/regression/html_output/custom_js_compressed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_block_core) == 'undefined'){
function isIE(){var myNav=navigator.userAgent.toLowerCase();return(myNav.indexOf('msie')!=-1)?parseInt(myNav.split('msie')[1]):false;}
var ieVersion=isIE();if(ieVersion&&ieVersion<10){alert("Internet Explorer 10 and older are not supported. Use Chrome, Firefox, Safari or IE 11 instead.");}
function blocksEval(data){(window.execScript||function(data){window["eval"].call(window,data);})(data);}
function registerWaitHandle(handle){if(!window.loadWaitHandleRegistry){window.loadWaitHandleRegistry={}}
loadWaitHandleRegistry[handle]=false;}
function setLoaded(handle){loadWaitHandleRegistry[handle]=true;}
function runWaitPoller(){var loadWaitPoller=setInterval(function(){if("loadWaitHandleRegistry"in window){var handleCount=0;for(var handle in loadWaitHandleRegistry){if(!loadWaitHandleRegistry.hasOwnProperty(handle)){handleCount++;if(!loadWaitHandleRegistry[handle]){return}}}}
clearInterval(loadWaitPoller);window.print();},10);return loadWaitPoller;}
_pybloqs_load_sentinel_block_core = true;}
</script>
<style type="text/css">
.pybloqs {
font-family: Helvetica, "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, sans-serif;
}

.pybloqs pre code {
display: block;
margin-left: 1em;
font-family: monospace;
}

@media print {
#footer {
position: fixed;
bottom: 0;
}
}
</style>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_TestJs) == 'undefined'){
(async function(){var code = await RawDeflate.inflate("eNpLzs8rzs9J1cvJT9dQcsvPV3g0Z4qSpjUAaX8Iig=="); blocksEval(code);})()
_pybloqs_load_sentinel_TestJs = true;}
</script>
</head>
<body>
<div class="pybloqs">
Some content
</div>
</body>
</html>
55 changes: 55 additions & 0 deletions tests/regression/html_output/custom_js_uncompressed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_block_core) == 'undefined'){
function isIE(){var myNav=navigator.userAgent.toLowerCase();return(myNav.indexOf('msie')!=-1)?parseInt(myNav.split('msie')[1]):false;}
var ieVersion=isIE();if(ieVersion&&ieVersion<10){alert("Internet Explorer 10 and older are not supported. Use Chrome, Firefox, Safari or IE 11 instead.");}
function blocksEval(data){(window.execScript||function(data){window["eval"].call(window,data);})(data);}
function registerWaitHandle(handle){if(!window.loadWaitHandleRegistry){window.loadWaitHandleRegistry={}}
loadWaitHandleRegistry[handle]=false;}
function setLoaded(handle){loadWaitHandleRegistry[handle]=true;}
function runWaitPoller(){var loadWaitPoller=setInterval(function(){if("loadWaitHandleRegistry"in window){var handleCount=0;for(var handle in loadWaitHandleRegistry){if(!loadWaitHandleRegistry.hasOwnProperty(handle)){handleCount++;if(!loadWaitHandleRegistry[handle]){return}}}}
clearInterval(loadWaitPoller);window.print();},10);return loadWaitPoller;}
_pybloqs_load_sentinel_block_core = true;}
</script>
<style type="text/css">
.pybloqs {
font-family: Helvetica, "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, sans-serif;
}

.pybloqs pre code {
display: block;
margin-left: 1em;
font-family: monospace;
}

@media print {
#footer {
position: fixed;
bottom: 0;
}
}
</style>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_TestJs) == 'undefined'){
console.log("Foo");
_pybloqs_load_sentinel_TestJs = true;}
</script>
</head>
<body>
<div class="pybloqs">
Some content
</div>
</body>
</html>
6 changes: 4 additions & 2 deletions tests/regression/html_output/flow.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate'))).text();}
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
Expand Down
6 changes: 4 additions & 2 deletions tests/regression/html_output/grid.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate'))).text();}
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
Expand Down
6 changes: 4 additions & 2 deletions tests/regression/html_output/hrule.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate'))).text();}
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
Expand Down
6 changes: 4 additions & 2 deletions tests/regression/html_output/hstack.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate'))).text();}
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
Expand Down
6 changes: 4 additions & 2 deletions tests/regression/html_output/markdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate'))).text();}
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
Expand Down
6 changes: 4 additions & 2 deletions tests/regression/html_output/nested.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate'))).text();}
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
Expand Down
6 changes: 4 additions & 2 deletions tests/regression/html_output/pre.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<meta charset="utf-8"/>
<script type="text/javascript">
if(typeof(_pybloqs_load_sentinel_jsinflate) == 'undefined'){
(function(){var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate'))).text();}
(function(){function decompress(bytes){const input=new ReadableStream({start(c){c.enqueue(bytes);c.close();},}).pipeThrough(new DecompressionStream("deflate"));const reader=input.getReader();const chunks=[];return reader.read().then(function process({done,value}){if(done){const decompressedData=new Uint8Array(chunks.reduce((acc,chunk)=>acc+chunk.length,0));let offset=0;chunks.forEach(chunk=>{decompressedData.set(chunk,offset);offset+=chunk.length;});return decompressedData;}
chunks.push(value);return reader.read().then(process);});}
var zip_inflate=async function(str){const binaryString=atob(str);var bytes=new Uint8Array(binaryString.length);for(var i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i);}
return decompress(bytes).then(decompressed=>(new TextDecoder().decode(decompressed))).catch(console.error);}
if(!window.RawDeflate)RawDeflate={};RawDeflate.inflate=zip_inflate;})();
_pybloqs_load_sentinel_jsinflate = true;}
</script>
Expand Down
Loading