Refactoring entities (#23)

* Still WIP

* WIP

* ArrayEntity parsing fixed

* Fix format text entity

* Tests for various entity classes and update entity class implementations

* More tests and fixed

* More entities fixed

* Simple entities serialization fixed

* Entities tests fixed

* Remove serialization bits

* Fix Function reference

* CustomProperties creating fixed

* WIP

* Better typing for grammars

* Decoding code fixes

* Fixing still

* Several fixes

* rename toString to serialize

* Several fixes

* More fixes

* Moving more stuff out of Utility

* Several fixes

* Fixing Linear color entity print

* Serialization fixes

* Fix serialization

* Method to compute grammar

* Renaming fix

* Fix array grammar and equality check

* Fix inlined keys

* Fix type

* Several serialization fixes

* Fix undefined dereference

* Several fixes

* More fixes and cleanup

* Fix keys quoting mechanism

* Fix natural number assignment

* Fix Int64 toString()

* Fix quoted keys for inlined arrays

* Fix PG pins

* Fix several test cases

* Types fixes

* New pin default value empty

* Fix non existing DefaultValue for variadic nodes

* Smaller fixes for crashes

* Fix link color when attached to knot

* Linking test and more reliability operations for adding pins

* Improve issue 18 test

* More tests and fixes

* Fix enum pin entity

* Remove failing test
This commit is contained in:
barsdeveloper
2024-09-08 11:46:36 +02:00
committed by GitHub
parent 31a07b992d
commit 23ee628e28
129 changed files with 8888 additions and 8584 deletions

View File

@@ -1,7 +1,7 @@
import Configuration from "../../js/Configuration.js"
import Utility from "../../js/Utility.js"
import PinElement from "../../js/element/PinElement.js"
import IntegerEntity from "../../js/entity/IntegerEntity.js"
import NumberEntity from "../../js/entity/NumberEntity.js"
import RBSerializationVector2DEntity from "../../js/entity/RBSerializationVector2DEntity.js"
import VectorEntity from "../../js/entity/VectorEntity.js"
import { expect } from "../fixtures/test.js"
@@ -70,10 +70,10 @@ export default class MaterialNodes extends NodeTests {
development: false,
additionalTest: async node => {
const value = 10000.0
/** @type {Locator<PinElement<Number>>} */
/** @type {Locator<PinElement<NumberEntity>>} */
const pin = node.locator("ueb-pin").first()
expect(await pin.evaluate(pin => pin.getDefaultValue())).toBeCloseTo(value)
await expect(node.locator("ueb-input")).toHaveText([Utility.printNumber(value)])
expect(await pin.evaluate(pin => pin.getDefaultValue().valueOf())).toBeCloseTo(value)
await expect(node.locator("ueb-input")).toHaveText([NumberEntity.printNumber(value)])
}
},
{
@@ -111,13 +111,13 @@ export default class MaterialNodes extends NodeTests {
additionalTest: async node => {
const x = 0.1
const y = 23.88888
/** @type {Locator<PinElement<Number>>} */
/** @type {Locator<PinElement<NumberEntity>>} */
const xPin = node.locator("ueb-pin").nth(0)
/** @type {Locator<PinElement<Number>>} */
/** @type {Locator<PinElement<NumberEntity>>} */
const yPin = node.locator("ueb-pin").nth(1)
expect(await xPin.evaluate(pin => pin.getDefaultValue())).toBeCloseTo(x)
expect(await yPin.evaluate(pin => pin.getDefaultValue())).toBeCloseTo(y)
await expect(node.locator("ueb-input")).toHaveText([Utility.printNumber(x), Utility.printNumber(y)])
expect(await xPin.evaluate(pin => pin.getDefaultValue().valueOf())).toBeCloseTo(x)
expect(await yPin.evaluate(pin => pin.getDefaultValue().valueOf())).toBeCloseTo(y)
await expect(node.locator("ueb-input")).toHaveText([NumberEntity.printNumber(x), NumberEntity.printNumber(y)])
}
},
{
@@ -157,7 +157,7 @@ export default class MaterialNodes extends NodeTests {
const values = await input.evaluate(pin => pin.getDefaultValue().toArray())
const expected = [0.00432, 123.199997, 7657650176.0]
expected.forEach((v, i) => expect(v).toBeCloseTo(values[i]))
await expect(input.locator("ueb-input")).toHaveText(expected.map(v => Utility.printNumber(v)))
await expect(input.locator("ueb-input")).toHaveText(expected.map(v => NumberEntity.printNumber(v)))
}
},
{
@@ -490,9 +490,7 @@ export default class MaterialNodes extends NodeTests {
color: Configuration.nodeColors.red,
icon: null,
pins: 2,
pinNames: [
"Preview",
],
pinNames: ["Preview"],
delegate: false,
development: false,
},
@@ -520,9 +518,7 @@ export default class MaterialNodes extends NodeTests {
color: Configuration.nodeColors.red,
icon: null,
pins: 2,
pinNames: [
"Preview",
],
pinNames: ["Preview"],
delegate: false,
development: false,
},