Add getImageBlob() support function for tests
This commit is contained in:
parent
06b28194da
commit
b566c06f93
2 changed files with 12 additions and 7 deletions
|
@ -981,6 +981,17 @@ async function createEmbeddedImage(parentItem, options = {}) {
|
|||
}
|
||||
|
||||
|
||||
async function getImageBlob() {
|
||||
var path = OS.Path.join(getTestDataDirectory().path, 'test.png');
|
||||
var imageData = await Zotero.File.getBinaryContentsAsync(path);
|
||||
var array = new Uint8Array(imageData.length);
|
||||
for (let i = 0; i < imageData.length; i++) {
|
||||
array[i] = imageData.charCodeAt(i);
|
||||
}
|
||||
return new Blob([array], { type: 'image/png' });
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the fake XHR server to response to a given response
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue