mutable width_100_height_100 = {
let log = ''
let isPassed = false
let width = 100
let height = 100
let expected = JSON.stringify({ width, height })
let container = DOM.element('div')
let isSame = (a, b) => {
try {
a = JSON.parse(a)
b = JSON.parse(b)
return isNumberSame(a.width, b.width) && isNumberSame(a.height, b.height)
} catch (e) {
return isStringSameIgnoreQuotesCase(a, b)
}
}
try {
refresh(container)
let netv = new NetV({
container,
width,
height,
backgroundColor: {r: 0, g: 0, b: 0, a: 1}
})
netv.draw()
const canvas = container.querySelector('canvas')
const zoom = detectZoom()
const actualWidth = canvas.width / zoom
const actualHeight = canvas.height / zoom
log = JSON.stringify({
width: actualWidth,
height: actualHeight
})
} catch (e) {
log = e.toString()
}
return {
title: `Width: ${width}, Height: ${height}`,
container,
log,
expected,
isPassed: isSame(expected, log)
}
}