mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-22 09:32:55 +02:00
[Test] Add missing methods to many mocks (#5891)
This commit is contained in:
parent
8fcb33d11a
commit
14e01c3da1
@ -1,4 +1,7 @@
|
|||||||
export interface MockGameObject {
|
export interface MockGameObject {
|
||||||
name: string;
|
name: string;
|
||||||
|
active: boolean;
|
||||||
destroy?(): void;
|
destroy?(): void;
|
||||||
|
setActive(active: boolean): this;
|
||||||
|
setName(name: string): this;
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,20 @@ import type { MockGameObject } from "./mockGameObject";
|
|||||||
/** Mocks video-related stuff */
|
/** Mocks video-related stuff */
|
||||||
export class MockVideoGameObject implements MockGameObject {
|
export class MockVideoGameObject implements MockGameObject {
|
||||||
public name: string;
|
public name: string;
|
||||||
|
public active = true;
|
||||||
|
|
||||||
public play = () => null;
|
public play = () => null;
|
||||||
public stop = () => this;
|
public stop = () => this;
|
||||||
public setOrigin = () => null;
|
public setOrigin = () => this;
|
||||||
public setScale = () => null;
|
public setScale = () => this;
|
||||||
public setVisible = () => null;
|
public setVisible = () => this;
|
||||||
public setLoop = () => null;
|
public setLoop = () => this;
|
||||||
|
public setName = (name: string) => {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
public setActive = (active: boolean) => {
|
||||||
|
this.active = active;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ export default class MockContainer implements MockGameObject {
|
|||||||
protected textureManager;
|
protected textureManager;
|
||||||
public list: MockGameObject[] = [];
|
public list: MockGameObject[] = [];
|
||||||
public name: string;
|
public name: string;
|
||||||
|
public active = true;
|
||||||
|
|
||||||
constructor(textureManager: MockTextureManager, x: number, y: number) {
|
constructor(textureManager: MockTextureManager, x: number, y: number) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@ -306,4 +307,9 @@ export default class MockContainer implements MockGameObject {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setActive(active: boolean): this {
|
||||||
|
this.active = active;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ export default class MockGraphics implements MockGameObject {
|
|||||||
private scene;
|
private scene;
|
||||||
public list: MockGameObject[] = [];
|
public list: MockGameObject[] = [];
|
||||||
public name: string;
|
public name: string;
|
||||||
|
public active = true;
|
||||||
constructor(textureManager, _config) {
|
constructor(textureManager, _config) {
|
||||||
this.scene = textureManager.scene;
|
this.scene = textureManager.scene;
|
||||||
}
|
}
|
||||||
@ -113,4 +114,9 @@ export default class MockGraphics implements MockGameObject {
|
|||||||
copyPosition(_source): this {
|
copyPosition(_source): this {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setActive(active: boolean): this {
|
||||||
|
this.active = active;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ export default class MockRectangle implements MockGameObject {
|
|||||||
private scene;
|
private scene;
|
||||||
public list: MockGameObject[] = [];
|
public list: MockGameObject[] = [];
|
||||||
public name: string;
|
public name: string;
|
||||||
|
public active = true;
|
||||||
|
|
||||||
constructor(textureManager, _x, _y, _width, _height, fillColor) {
|
constructor(textureManager, _x, _y, _width, _height, fillColor) {
|
||||||
this.fillColor = fillColor;
|
this.fillColor = fillColor;
|
||||||
@ -96,4 +97,9 @@ export default class MockRectangle implements MockGameObject {
|
|||||||
off(): this {
|
off(): this {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setActive(active: boolean): this {
|
||||||
|
this.active = active;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ export default class MockSprite implements MockGameObject {
|
|||||||
public anims;
|
public anims;
|
||||||
public list: MockGameObject[] = [];
|
public list: MockGameObject[] = [];
|
||||||
public name: string;
|
public name: string;
|
||||||
|
public active = true;
|
||||||
constructor(textureManager, x, y, texture) {
|
constructor(textureManager, x, y, texture) {
|
||||||
this.textureManager = textureManager;
|
this.textureManager = textureManager;
|
||||||
this.scene = textureManager.scene;
|
this.scene = textureManager.scene;
|
||||||
@ -247,4 +248,9 @@ export default class MockSprite implements MockGameObject {
|
|||||||
this.phaserSprite.copyPosition(obj);
|
this.phaserSprite.copyPosition(obj);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setActive(active: boolean): this {
|
||||||
|
this.phaserSprite.setActive(active);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ export default class MockText implements MockGameObject {
|
|||||||
public text = "";
|
public text = "";
|
||||||
public name: string;
|
public name: string;
|
||||||
public color?: string;
|
public color?: string;
|
||||||
|
public active = true;
|
||||||
|
|
||||||
constructor(textureManager, _x, _y, _content, _styleOptions) {
|
constructor(textureManager, _x, _y, _content, _styleOptions) {
|
||||||
this.scene = textureManager.scene;
|
this.scene = textureManager.scene;
|
||||||
@ -354,4 +355,8 @@ export default class MockText implements MockGameObject {
|
|||||||
|
|
||||||
// biome-ignore lint/complexity/noBannedTypes: This matches the signature of the class this mocks
|
// biome-ignore lint/complexity/noBannedTypes: This matches the signature of the class this mocks
|
||||||
on(_event: string | symbol, _fn: Function, _context?: any) {}
|
on(_event: string | symbol, _fn: Function, _context?: any) {}
|
||||||
|
|
||||||
|
setActive(_active: boolean): this {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ export default class MockTexture implements MockGameObject {
|
|||||||
public frames: object;
|
public frames: object;
|
||||||
public firstFrame: string;
|
public firstFrame: string;
|
||||||
public name: string;
|
public name: string;
|
||||||
|
public active: boolean;
|
||||||
|
|
||||||
constructor(manager, key: string, source) {
|
constructor(manager, key: string, source) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
@ -39,4 +40,14 @@ export default class MockTexture implements MockGameObject {
|
|||||||
getSourceImage() {
|
getSourceImage() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setActive(active: boolean): this {
|
||||||
|
this.active = active;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
setName(name: string): this {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user