Move image utilities into /spec to make it clear that they are only for testing
This commit is contained in:
parent
c05f40d960
commit
2e708ebb4d
|
@ -0,0 +1,5 @@
|
||||||
|
import {matchers} from '../image/ImageSimilarity.mjs';
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
jasmine.addMatchers(matchers);
|
||||||
|
});
|
|
@ -1,7 +1,7 @@
|
||||||
/* eslint-disable max-statements */
|
/* eslint-disable max-statements */
|
||||||
|
|
||||||
import ImageRegion from './ImageRegion.mjs';
|
import ImageRegion from './ImageRegion.mjs';
|
||||||
import {nodejs} from '../core/browser.mjs';
|
import {nodejs} from '../../scripts/core/browser.mjs';
|
||||||
|
|
||||||
describe('ImageRegion', () => {
|
describe('ImageRegion', () => {
|
||||||
function makeCanvas(w, h) {
|
function makeCanvas(w, h) {
|
|
@ -1,7 +1,7 @@
|
||||||
import './Blur.mjs';
|
import './Blur.mjs';
|
||||||
import './Composition.mjs';
|
import './Composition.mjs';
|
||||||
import ImageRegion from './ImageRegion.mjs';
|
import ImageRegion from './ImageRegion.mjs';
|
||||||
import {headless} from '../core/browser.mjs';
|
import {headless} from '../../scripts/core/browser.mjs';
|
||||||
|
|
||||||
function getThresholds({
|
function getThresholds({
|
||||||
pixelThresh = 2,
|
pixelThresh = 2,
|
|
@ -1,7 +1,6 @@
|
||||||
import ImageRegion from '../image/ImageRegion.mjs';
|
import ImageRegion from './image/ImageRegion.mjs';
|
||||||
import SequenceDiagram from './SequenceDiagram.mjs';
|
import SequenceDiagram from '../scripts/sequence/SequenceDiagram.mjs';
|
||||||
import TESTS from '../../spec/images/list.mjs';
|
import TESTS from './images/list.mjs';
|
||||||
import {matchers} from '../image/ImageSimilarity.mjs';
|
|
||||||
|
|
||||||
describe('SequenceDiagram Visuals', () => {
|
describe('SequenceDiagram Visuals', () => {
|
||||||
const RESOLUTION = 4;
|
const RESOLUTION = 4;
|
||||||
|
@ -48,8 +47,6 @@ describe('SequenceDiagram Visuals', () => {
|
||||||
|
|
||||||
TESTS.forEach((image) => {
|
TESTS.forEach((image) => {
|
||||||
it('renders ' + image + ' as expected', (done) => {
|
it('renders ' + image + ' as expected', (done) => {
|
||||||
jasmine.addMatchers(matchers);
|
|
||||||
|
|
||||||
loadAndRenderURL(IMAGE_BASE_PATH + image)
|
loadAndRenderURL(IMAGE_BASE_PATH + image)
|
||||||
.then(({actual, expected, code}) => {
|
.then(({actual, expected, code}) => {
|
||||||
const widthSm = Math.min(Math.round(actual.width / 4), 150);
|
const widthSm = Math.min(Math.round(actual.width / 4), 150);
|
|
@ -1,6 +1,5 @@
|
||||||
import ImageRegion from '../image/ImageRegion.mjs';
|
import ImageRegion from './image/ImageRegion.mjs';
|
||||||
import SequenceDiagram from './SequenceDiagram.mjs';
|
import SequenceDiagram from '../scripts/sequence/SequenceDiagram.mjs';
|
||||||
import {matchers} from '../image/ImageSimilarity.mjs';
|
|
||||||
|
|
||||||
const RESOLUTION = 4;
|
const RESOLUTION = 4;
|
||||||
|
|
||||||
|
@ -33,7 +32,6 @@ function makeSampleTests({file, code}, index) {
|
||||||
describe('example #' + (index + 1), () => {
|
describe('example #' + (index + 1), () => {
|
||||||
if(file && !SCREENSHOT_BLACKLIST.includes(file)) {
|
if(file && !SCREENSHOT_BLACKLIST.includes(file)) {
|
||||||
it('looks like ' + file + ' when rendered', (done) => {
|
it('looks like ' + file + ' when rendered', (done) => {
|
||||||
jasmine.addMatchers(matchers);
|
|
||||||
let actual = null;
|
let actual = null;
|
||||||
new SequenceDiagram(code)
|
new SequenceDiagram(code)
|
||||||
.getCanvas({resolution: RESOLUTION})
|
.getCanvas({resolution: RESOLUTION})
|
Loading…
Reference in New Issue