pokerogue/test/test-utils/mocks/mocks-container/mock-texture.ts
Sirz Benjie 51d4c33de0
[Misc] Standardize-file-names (#6137)
* Standardize filenames to kebab-case

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>

* Move script outside of public folder

* Move update_exp_sprites to scripts

* Add ls-lint to lint file and directory names

* Update lefthook.yml to skip merge / rebase on all pre-commit commands

---------

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>
2025-07-24 16:38:31 -04:00

54 lines
1.2 KiB
TypeScript

import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object";
import type { MockTextureManager } from "#test/test-utils/mocks/mock-texture-manager";
/**
* Stub for Phaser.Textures.Texture object
* Just mocks the function calls and data required for use in tests
*/
export class MockTexture implements MockGameObject {
public manager: MockTextureManager;
public key: string;
public source;
public frames: object;
public firstFrame: string;
public name: string;
public active: boolean;
constructor(manager, key: string, source) {
this.manager = manager;
this.key = key;
this.source = source;
const mockFrame = {
width: 100,
height: 100,
cutX: 0,
cutY: 0,
};
this.frames = {
firstFrame: mockFrame,
0: mockFrame,
1: mockFrame,
2: mockFrame,
3: mockFrame,
4: mockFrame,
};
this.firstFrame = "firstFrame";
}
/** Mocks the function call that gets an HTMLImageElement, see {@link Pokemon.updateFusionPalette} */
getSourceImage() {
return null;
}
setActive(active: boolean): this {
this.active = active;
return this;
}
setName(name: string): this {
this.name = name;
return this;
}
}