mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 17:47:16 +00:00
Ensure we have no extra methods (#861)
This commit is contained in:
parent
a14276daf9
commit
563e9cbb64
3 changed files with 31 additions and 17 deletions
|
|
@ -27,7 +27,7 @@ for (let [key, Klass] of Object.entries(runtime)) {
|
|||
});
|
||||
}
|
||||
|
||||
test("Track all missing methods", () => {
|
||||
describe("Maki classes", () => {
|
||||
const runtimeMethods = new Set();
|
||||
const objectMethods = new Set();
|
||||
for (let [key, Klass] of Object.entries(runtime)) {
|
||||
|
|
@ -40,9 +40,31 @@ test("Track all missing methods", () => {
|
|||
});
|
||||
}
|
||||
|
||||
const missing = [...objectMethods].filter(x => !runtimeMethods.has(x)).sort();
|
||||
test("have no extra methods", () => {
|
||||
// getclassname _should_ be implemented on Object and let each class inherit
|
||||
// it. However it's far easier to implement it on each class directly, so
|
||||
// we'll allow that.
|
||||
function isntGetClassname(method) {
|
||||
return !/\.getclassname$/.test(method);
|
||||
}
|
||||
|
||||
expect(missing).toMatchInlineSnapshot(`
|
||||
function isntMakiMethod(method) {
|
||||
return !objectMethods.has(method);
|
||||
}
|
||||
|
||||
const extra = [...runtimeMethods]
|
||||
.filter(isntMakiMethod)
|
||||
.filter(isntGetClassname);
|
||||
|
||||
expect(extra).toEqual([]);
|
||||
});
|
||||
|
||||
test("Track all missing methods", () => {
|
||||
const missing = [...objectMethods]
|
||||
.filter(x => !runtimeMethods.has(x))
|
||||
.sort();
|
||||
|
||||
expect(missing).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"AnimatedLayer.getautoreplay",
|
||||
"AnimatedLayer.getcurframe",
|
||||
|
|
@ -696,4 +718,5 @@ Array [
|
|||
"Wac.show",
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,11 +22,6 @@ class GuiObject extends MakiObject {
|
|||
return findDescendantByTypeAndId(this, null, id);
|
||||
}
|
||||
|
||||
getobject(id) {
|
||||
// Not sure this is correct, but it is my understanding this is just an alias
|
||||
return this.findobject(id);
|
||||
}
|
||||
|
||||
init(newRoot) {
|
||||
this.parent = newRoot;
|
||||
newRoot.js_addChild(this);
|
||||
|
|
@ -78,6 +73,11 @@ class GuiObject extends MakiObject {
|
|||
this.attributes.y = y;
|
||||
this.attributes.w = w;
|
||||
this.attributes.h = h;
|
||||
// TODO: Confirm that GuiObject actually supports these min/max attributes
|
||||
this.attributes.minimum_w = w;
|
||||
this.attributes.maximum_w = w;
|
||||
this.attributes.minimum_h = h;
|
||||
this.attributes.maximum_h = h;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,15 +15,6 @@ class Layout extends Group {
|
|||
getcontainer() {
|
||||
return findParentNodeOfType(this, new Set(["container"]));
|
||||
}
|
||||
|
||||
resize(x, y, w, h) {
|
||||
this.attributes.x = x;
|
||||
this.attributes.y = y;
|
||||
this.attributes.minimum_w = w;
|
||||
this.attributes.maximum_w = w;
|
||||
this.attributes.minimum_h = h;
|
||||
this.attributes.maximum_h = h;
|
||||
}
|
||||
}
|
||||
|
||||
export default Layout;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue