df14c25fbe
Signed-off-by: Dennis Francis <dennis.francis@collabora.com> Change-Id: Id441837e6939297d40870761dd191c7f4240b677
54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
/// <reference path="./refs/globals.ts"/>
|
|
/// <reference path="../src/geometry/Point.ts" />
|
|
/// <reference path="../src/geometry/Bounds.ts" />
|
|
/// <reference path="../src/layer/tile/CanvasSectionContainer.ts" />
|
|
/// <reference path="./helper/canvasContainerSetup.ts" />
|
|
/// <reference path="./helper/rectUtil.ts" />
|
|
|
|
var jsdom = require('jsdom');
|
|
var assert = require('assert').strict;
|
|
|
|
var dom = new jsdom.JSDOM(canvasDomString());
|
|
|
|
global.window = dom.window;
|
|
global.document = dom.window.document;
|
|
|
|
const canvasWidth = 1024;
|
|
const canvasHeight = 768;
|
|
|
|
describe('Singleton section container', function() {
|
|
const canvas = <HTMLCanvasElement>document.getElementById('document-canvas');
|
|
const docLayer = {};
|
|
const tsManager = {};
|
|
|
|
const sectionContainer = new CanvasSectionContainer(canvas, true /* disableDrawing? */);
|
|
sectionContainer.onResize(canvasWidth, canvasHeight); // Set canvas size.
|
|
|
|
sectionContainer.createSection({
|
|
name: 'OnlySection',
|
|
anchor: 'top left',
|
|
position: [0, 0],
|
|
size: [1, 1],
|
|
expand: 'bottom right',
|
|
processingOrder: 1,
|
|
drawingOrder: 1,
|
|
zIndex: 1,
|
|
interactable: false,
|
|
sectionProperties: {
|
|
docLayer: docLayer,
|
|
tsManager: tsManager,
|
|
strokeStyle: '#c0c0c0'
|
|
},
|
|
});
|
|
|
|
sectionContainer.enableDrawing();
|
|
it('Container should have OnlySection', function() {
|
|
assert.ok(sectionContainer.doesSectionExist('OnlySection'));
|
|
});
|
|
|
|
it('OnlySection PosSize checks', function () {
|
|
const only = sectionContainer.getSectionWithName('OnlySection');
|
|
const onlyRect = getSectionRectangle(only);
|
|
assertPosSize(onlyRect, {x: 0, y: 0, width: 1024, height: 768});
|
|
});
|
|
});
|