askui
Version:
Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on
41 lines (40 loc) • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageReference = void 0;
class ImageReference {
constructor(base64Image, width, height, xTopLeft, yTopLeft) {
this.base64Image = base64Image;
this.width = width;
this.height = height;
this.xTopLeft = xTopLeft;
this.yTopLeft = yTopLeft;
}
static fromJson(json) {
if (json.base64Image === undefined) {
throw new Error('the key "base64Image" is required');
}
if (json.width === undefined) {
throw new Error('the key "width" is required');
}
if (json.height === undefined) {
throw new Error('the key "height" is required');
}
if (json.xTopLeft === undefined) {
throw new Error('the key "xTopLeft" is required');
}
if (json.yTopLeft === undefined) {
throw new Error('the key "yTopLeft" is required');
}
return new ImageReference(json.base64Image, json.width, json.height, json.xTopLeft, json.yTopLeft);
}
toJson() {
return {
base64Image: this.base64Image,
height: this.height,
width: this.width,
xTopLeft: this.xTopLeft,
yTopLeft: this.yTopLeft,
};
}
}
exports.ImageReference = ImageReference;