Option to send photos as high quality

This commit is contained in:
Josh Perez 2021-06-25 12:08:16 -04:00 committed by GitHub
parent 6c56d5a5f1
commit 01eabf9ec6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 1263 additions and 363 deletions

View file

@ -0,0 +1,27 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { canvasToBlob } from '../../util/canvasToBlob';
describe('canvasToBlob', () => {
it('converts a canvas to an Blob', async () => {
const canvas = document.createElement('canvas');
canvas.width = 100;
canvas.height = 200;
const context = canvas.getContext('2d');
if (!context) {
throw new Error('Test setup error: cannot get canvas rendering context');
}
context.fillStyle = '#ff9900';
context.fillRect(10, 10, 20, 20);
const result = await canvasToBlob(canvas);
// These are just smoke tests.
assert.instanceOf(result, Blob);
assert.isAtLeast(result.size, 50);
});
});