mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 17:12:44 +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 {
|
||||
name: string;
|
||||
active: boolean;
|
||||
destroy?(): void;
|
||||
setActive(active: boolean): this;
|
||||
setName(name: string): this;
|
||||
}
|
||||
|
@ -3,11 +3,20 @@ import type { MockGameObject } from "./mockGameObject";
|
||||
/** Mocks video-related stuff */
|
||||
export class MockVideoGameObject implements MockGameObject {
|
||||
public name: string;
|
||||
public active = true;
|
||||
|
||||
public play = () => null;
|
||||
public stop = () => this;
|
||||
public setOrigin = () => null;
|
||||
public setScale = () => null;
|
||||
public setVisible = () => null;
|
||||
public setLoop = () => null;
|
||||
public setOrigin = () => this;
|
||||
public setScale = () => this;
|
||||
public setVisible = () => this;
|
||||
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;
|
||||
public list: MockGameObject[] = [];
|
||||
public name: string;
|
||||
public active = true;
|
||||
|
||||
constructor(textureManager: MockTextureManager, x: number, y: number) {
|
||||
this.x = x;
|
||||
@ -306,4 +307,9 @@ export default class MockContainer implements MockGameObject {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
setActive(active: boolean): this {
|
||||
this.active = active;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ export default class MockGraphics implements MockGameObject {
|
||||
private scene;
|
||||
public list: MockGameObject[] = [];
|
||||
public name: string;
|
||||
public active = true;
|
||||
constructor(textureManager, _config) {
|
||||
this.scene = textureManager.scene;
|
||||
}
|
||||
@ -113,4 +114,9 @@ export default class MockGraphics implements MockGameObject {
|
||||
copyPosition(_source): this {
|
||||
return this;
|
||||
}
|
||||
|
||||
setActive(active: boolean): this {
|
||||
this.active = active;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ export default class MockRectangle implements MockGameObject {
|
||||
private scene;
|
||||
public list: MockGameObject[] = [];
|
||||
public name: string;
|
||||
public active = true;
|
||||
|
||||
constructor(textureManager, _x, _y, _width, _height, fillColor) {
|
||||
this.fillColor = fillColor;
|
||||
@ -96,4 +97,9 @@ export default class MockRectangle implements MockGameObject {
|
||||
off(): 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 list: MockGameObject[] = [];
|
||||
public name: string;
|
||||
public active = true;
|
||||
constructor(textureManager, x, y, texture) {
|
||||
this.textureManager = textureManager;
|
||||
this.scene = textureManager.scene;
|
||||
@ -247,4 +248,9 @@ export default class MockSprite implements MockGameObject {
|
||||
this.phaserSprite.copyPosition(obj);
|
||||
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 name: string;
|
||||
public color?: string;
|
||||
public active = true;
|
||||
|
||||
constructor(textureManager, _x, _y, _content, _styleOptions) {
|
||||
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
|
||||
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 firstFrame: string;
|
||||
public name: string;
|
||||
public active: boolean;
|
||||
|
||||
constructor(manager, key: string, source) {
|
||||
this.manager = manager;
|
||||
@ -39,4 +40,14 @@ export default class MockTexture implements MockGameObject {
|
||||
getSourceImage() {
|
||||
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