Additional tests

This commit is contained in:
barsdeveloper
2023-02-10 23:10:49 +01:00
parent 319f5af77f
commit 4f4d58ed69
7 changed files with 167 additions and 81 deletions

View File

@@ -1,27 +1,93 @@
/// <reference types="cypress" />
import Configuration from "../../js/Configuration"
import Utility from "../../js/Utility"
import PinElement from "../../js/element/PinElement"
import LinearColorEntity from "../../js/entity/LinearColorEntity"
describe('empty spec', () => {
it('passes', () => {
cy.visit(`http://127.0.0.1:${Cypress.env("UEBLUEPRINT_TEST_SERVER_PORT")}/empty.html`)
cy.get("ueb-blueprint")
.click(100, 300)
.then(blueprint => Utility.paste(blueprint[0], String.raw`
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_0"
FunctionReference=(MemberParent=/Script/CoreUObject.Class'"/Script/UMG.WidgetBlueprintLibrary"',MemberName="DrawBox")
NodePosX=-528
NodePosY=16
NodeGuid=CCD05D4C46B44D439A8A54892EF35583
CustomProperties Pin (PinId=5FBDA39535314BB8A54233DACD0127B5,PinName="execute",PinToolTip="\nExec",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=50CAADA252984578932EC85ABF55694C,PinName="then",PinToolTip="\nExec",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=55779C53183948C1B4EF08ADB42E06EB,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nWidget Blueprint Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/UMG.WidgetBlueprintLibrary"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/UMG.Default__WidgetBlueprintLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=7EB988E8F2B4448AAE788347A8B1A52A,PinName="Context",PinToolTip="Context\nPaint Context Structure (by ref)",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/UMG.PaintContext"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=6FC51CC5388D41A19A21A3BBB73D709D,PinName="Position",PinToolTip="Position\nVector 2D Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector2D"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=CFF6C22A93A44624B9E9D3062A0D2C92,PinName="Size",PinToolTip="Size\nVector 2D Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector2D"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=0F39A82607874DEBB85E7CF660A8CEE5,PinName="Brush",PinToolTip="Brush\nSlate Brush Asset Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.SlateBrushAsset"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=24480A396D474F85A2891846975A2AC6,PinName="Tint",PinToolTip="Tint\nLinear Color Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.LinearColor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="(R=1.000000,G=1.000000,B=1.000000,A=1.000000)",AutogeneratedDefaultValue="(R=1.000000,G=1.000000,B=1.000000,A=1.000000)",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
`))
/** @type {Blueprint} */
let blueprint
before(() => {
cy.visit(`http://127.0.0.1:${Cypress.env("UEBLUEPRINT_TEST_SERVER_PORT")}/empty.html`)
cy.get("ueb-blueprint")
.click(100, 300)
.then(blueprint => blueprint[0].removeGraphElement(...blueprint[0].getNodes()))
.then(blueprint => Utility.paste(blueprint[0], String.raw`
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_0"
FunctionReference=(MemberParent=/Script/CoreUObject.Class'"/Script/UMG.WidgetBlueprintLibrary"',MemberName="DrawBox")
NodePosX=-528
NodePosY=16
NodeGuid=CCD05D4C46B44D439A8A54892EF35583
CustomProperties Pin (PinId=5FBDA39535314BB8A54233DACD0127B5,PinName="execute",PinToolTip="\nExec",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=50CAADA252984578932EC85ABF55694C,PinName="then",PinToolTip="\nExec",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=55779C53183948C1B4EF08ADB42E06EB,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nWidget Blueprint Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/UMG.WidgetBlueprintLibrary"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/UMG.Default__WidgetBlueprintLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=7EB988E8F2B4448AAE788347A8B1A52A,PinName="Context",PinToolTip="Context\nPaint Context Structure (by ref)",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/UMG.PaintContext"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=6FC51CC5388D41A19A21A3BBB73D709D,PinName="Position",PinToolTip="Position\nVector 2D Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector2D"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=CFF6C22A93A44624B9E9D3062A0D2C92,PinName="Size",PinToolTip="Size\nVector 2D Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector2D"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=0F39A82607874DEBB85E7CF660A8CEE5,PinName="Brush",PinToolTip="Brush\nSlate Brush Asset Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.SlateBrushAsset"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=24480A396D474F85A2891846975A2AC6,PinName="Tint",PinToolTip="Tint\nLinear Color Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.LinearColor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="(R=1.000000,G=1.000000,B=1.000000,A=1.000000)",AutogeneratedDefaultValue="(R=1.000000,G=1.000000,B=1.000000,A=1.000000)",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
`))
})
context("Color picker", () => {
let color
it("Can cancel the operation", () => {
cy.get("ueb-window")
.should("not.exist")
cy.contains("ueb-pin", "Tint")
.then(pin => (color = pin[0].dataset.color, pin))
.find(".ueb-pin-input")
.click()
cy.get("ueb-window")
.should("exist")
.contains(Configuration.windowCancelButtonText)
.click()
.should("not.exist")
cy.contains("ueb-pin", "Tint")
.then(
/** @param {JQuery<PinElement<LinearColorEntity>>} pin */
pin => expect(color).to.not.be.undefined.and.to.be.equal(pin[0].getDefaultValue().toString()))
})
it("Can close the window", () => {
cy.get("ueb-window")
.should("not.exist")
cy.contains("ueb-pin", "Tint")
.then(pin => (color = pin[0].dataset.color, pin))
.find(".ueb-pin-input")
.click()
cy.get("ueb-window")
.should("exist")
.find(".ueb-window-close")
.click()
.should("not.exist")
cy.contains("ueb-pin", "Tint")
.then(
/** @param {JQuery<PinElement<LinearColorEntity>>} pin */
pin => expect(color).to.not.be.undefined.and.to.be.equal(pin[0].getDefaultValue().toString()))
})
it("Ok changes the color", () => {
cy.get("ueb-window")
.should("not.exist")
cy.contains("ueb-pin", "Tint")
.find(".ueb-pin-input")
.click()
cy.get("ueb-window")
.should("exist")
.find(".ueb-color-picker-wheel")
.click("bottom")
cy.contains("ueb-window *", Configuration.windowApplyButtonText)
.click()
cy.get("ueb-window")
.should("not.exist")
cy.contains("ueb-pin", "Tint")
.then(
/** @param {JQuery<PinElement<LinearColorEntity>>} pin */
pin => expect(color).to.not.be.undefined.and.to.not.be.equal(pin[0].getDefaultValue().toString()))
})
})

View File

@@ -1,6 +1,6 @@
/// <reference types="cypress" />
import { generateNodeTest } from "../fixtures/getFirstWordOrder"
import { generateNodeTest } from "../fixtures/testUtilities"
import Configuration from "../../js/Configuration"
import SVGIcon from "../../js/SVGIcon"

View File

@@ -2,7 +2,7 @@
import Blueprint from "../../js/Blueprint"
import Configuration from "../../js/Configuration"
import { generateNodeTest } from "../fixtures/getFirstWordOrder"
import { generateNodeTest } from "../fixtures/testUtilities"
import SVGIcon from "../../js/SVGIcon"
const tests = [

View File

@@ -1,6 +1,6 @@
/// <reference types="cypress" />
import { generateNodeTest } from "../fixtures/getFirstWordOrder"
import { generateNodeTest } from "../fixtures/testUtilities"
import Configuration from "../../js/Configuration"
import SVGIcon from "../../js/SVGIcon"

View File

@@ -1,6 +1,6 @@
/// <reference types="cypress" />
import { generateNodeTest } from "../fixtures/getFirstWordOrder"
import { generateNodeTest } from "../fixtures/testUtilities"
import Configuration from "../../js/Configuration"
import SVGIcon from "../../js/SVGIcon"

View File

@@ -1,30 +1,20 @@
/// <reference types="cypress" />
import SerializerFactory from "../../js/serialization/SerializerFactory"
import initializeSerializerFactory from "../../js/serialization/initializeSerializerFactory"
import VectorEntity from "../../js/entity/VectorEntity"
import Vector2DEntity from "../../js/entity/Vector2DEntity"
import IntegerEntity from "../../js/entity/IntegerEntity"
import LinearColorEntity from "../../js/entity/LinearColorEntity"
import SerializerFactory from "../../js/serialization/SerializerFactory"
import Utility from "../../js/Utility"
import ISerializer from "../../js/serialization/ISerializer"
import Vector2DEntity from "../../js/entity/Vector2DEntity"
import VectorEntity from "../../js/entity/VectorEntity"
import KeyBindingEntity from "../../js/entity/KeyBindingEntity"
initializeSerializerFactory()
describe("Serializer", () => {
before(() => {
expect(SerializerFactory,).to.be.a("function")
expect(initializeSerializerFactory).to.be.a("function")
initializeSerializerFactory()
})
context("Boolean", () => {
/** @type {ISerializer<Boolean>} */
let serializer
before(() => {
serializer = SerializerFactory.getSerializer(Boolean)
expect(serializer).to.not.be.undefined
})
let serializer = SerializerFactory.getSerializer(Boolean)
it("parses true", () => expect(serializer.deserialize("true")).to.be.true)
it("parses True", () => expect(serializer.deserialize("True")).to.be.true)
@@ -35,26 +25,70 @@ describe("Serializer", () => {
context("Integer", () => {
let serializer = SerializerFactory.getSerializer(IntegerEntity)
before(() => {
serializer = SerializerFactory.getSerializer(IntegerEntity)
expect(serializer).to.not.be.undefined
})
it("parses 99", () => expect(serializer.deserialize("99").value).to.be.equal(99))
it("parses -8685", () => expect(serializer.deserialize("-8685").value).to.be.equal(-8685))
it("parses +555", () => expect(serializer.deserialize("+555").value).to.be.equal(555))
it("parses 0", () => expect(serializer.deserialize("0"))
.to.be.instanceOf(IntegerEntity)
.and.property("value").to.be.equal(0)
)
it("parses +0", () => expect(serializer.deserialize("+0"))
.to.be.instanceOf(IntegerEntity)
.and.property("value").to.be.equal(0)
)
it("parses -0", () => expect(serializer.deserialize("-0"))
.to.be.instanceOf(IntegerEntity)
.and.property("value").to.be.equal(0)
)
it("parses 99", () => expect(serializer.deserialize("99"))
.to.be.instanceOf(IntegerEntity)
.and.property("value").to.be.equal(99)
)
it("parses -8685", () => expect(serializer.deserialize("-8685"))
.to.be.instanceOf(IntegerEntity)
.and.property("value").to.be.equal(-8685)
)
it("parses +555", () => expect(serializer.deserialize("+555"))
.to.be.instanceOf(IntegerEntity)
.and.property("value").to.be.equal(555)
)
it("parses 1000000000", () => expect(serializer.deserialize("1000000000"))
.to.be.instanceOf(IntegerEntity)
.and.property("value").to.be.equal(1000000000)
)
it("throws when not an integer", () => expect(() => serializer.deserialize("1.2").value).to.throw())
})
context("Vector", () => {
/** @type {ISerializer<VectorEntity>} */
let serializer
context("Number", () => {
let serializer = SerializerFactory.getSerializer(Number)
before(() => {
serializer = SerializerFactory.getSerializer(VectorEntity)
expect(VectorEntity.expectsAllKeys()).to.be.true
expect(serializer).to.not.be.undefined
})
it("parses 0", () => expect(serializer.deserialize("0")).to.be.approximately(0, 0.00001))
it("parses +0", () => expect(serializer.deserialize("+0")).to.be.approximately(0, 0.00001))
it("parses -0", () => expect(serializer.deserialize("-0")).to.be.approximately(0, 0.00001))
it("parses 5", () => expect(serializer.deserialize("5")).to.be.approximately(5, 0.00001))
it("parses 0.05", () => expect(serializer.deserialize("0.05")).to.be.approximately(0.05, 0.00001))
it("parses -999.666", () => expect(serializer.deserialize("-999.666")).to.be.approximately(-999.666, 0.001))
it("parses +45.4545", () => expect(serializer.deserialize("+45.4545")).to.be.approximately(45.4545, 0.001))
it("parses +1000000000", () => expect(serializer.deserialize("+1000000000")).to.be.approximately(1E9, 0.1))
it("throws when not numeric", () => expect(() => serializer.deserialize("alpha")).to.throw())
})
context("Number", () => {
let serializer = SerializerFactory.getSerializer(KeyBindingEntity)
it("parses (bCtrl=True,Key=A)", () => expect(serializer.deserialize("(bCtrl=True,Key=A)"))
.to.be.instanceOf(KeyBindingEntity)
//.and.to.contain({ bCtrl: true })
)
// it("parses +0", () => expect(serializer.deserialize("+0")).to.be.approximately(0, 0.00001))
// it("parses -0", () => expect(serializer.deserialize("-0")).to.be.approximately(0, 0.00001))
// it("parses 5", () => expect(serializer.deserialize("5")).to.be.approximately(5, 0.00001))
// it("parses 0.05", () => expect(serializer.deserialize("0.05")).to.be.approximately(0.05, 0.00001))
// it("parses -999.666", () => expect(serializer.deserialize("-999.666")).to.be.approximately(-999.666, 0.001))
// it("parses +45.4545", () => expect(serializer.deserialize("+45.4545")).to.be.approximately(45.4545, 0.001))
// it("parses +1000000000", () => expect(serializer.deserialize("+1000000000")).to.be.approximately(1E9, 0.1))
// it("throws when not numeric", () => expect(() => serializer.deserialize("alpha")).to.throw())
})
context("Vector", () => {
let serializer = SerializerFactory.getSerializer(VectorEntity)
it("parses simple vector", () => expect(serializer.deserialize("(X=1,Y=2,Z=3.5)"))
.to.be.deep.equal({
@@ -98,14 +132,7 @@ describe("Serializer", () => {
})
context("Vector2D", () => {
/** @type {ISerializer<Vector2DEntity>} */
let serializer
before(() => {
serializer = SerializerFactory.getSerializer(Vector2DEntity)
expect(Vector2DEntity.expectsAllKeys()).to.be.true
expect(serializer).to.not.be.undefined
})
let serializer = SerializerFactory.getSerializer(Vector2DEntity)
it("parses simple vector", () => expect(serializer.deserialize("(X=78,Y=56.3)"))
.to.be.deep.equal({
@@ -142,14 +169,7 @@ describe("Serializer", () => {
})
context("Linear color", () => {
/** @type {ISerializer<LinearColorEntity>} */
let serializer
before(() => {
serializer = SerializerFactory.getSerializer(LinearColorEntity)
expect(LinearColorEntity.expectsAllKeys()).to.be.false
expect(serializer).to.not.be.undefined
})
let serializer = SerializerFactory.getSerializer(LinearColorEntity)
it("check white color", () => {
const result = LinearColorEntity.getWhite()

View File

@@ -19,8 +19,8 @@ export function generateNodeTest(nodeTest, getBlueprint) {
Utility.paste(getBlueprint(), nodeTest.value)
node = getBlueprint().querySelector("ueb-node")
})
it("has correct color", () => expect(node.entity.nodeColor()).to.be.deep.equal(nodeTest.color))
it("has correct delegate", () => {
it("Has correct color", () => expect(node.entity.nodeColor()).to.be.deep.equal(nodeTest.color))
it("Has correct delegate", () => {
const delegate = node.querySelector('.ueb-node-top ueb-pin[data-type="delegate"]')
if (nodeTest.delegate) {
expect(delegate).to.not.be.null
@@ -28,11 +28,11 @@ export function generateNodeTest(nodeTest, getBlueprint) {
expect(delegate).to.be.null
}
})
it("is called " + nodeTest.name, () => expect(node.getNodeDisplayName()).to.be.equal(nodeTest.name))
it("has the correct icon", () => expect(node.entity.nodeIcon()).to.be.deep.equal(nodeTest.icon))
it(`has ${nodeTest.pins} pins`, () => expect(node.querySelectorAll("ueb-pin")).to.be.lengthOf(nodeTest.pins))
it("expected development", () => expect(node.entity.isDevelopmentOnly()).equals(nodeTest.development))
it("maintains the order of attributes", () => {
it("It's called " + nodeTest.name, () => expect(node.getNodeDisplayName()).to.be.equal(nodeTest.name))
it("Has the correct icon", () => expect(node.entity.nodeIcon()).to.be.deep.equal(nodeTest.icon))
it(`Has ${nodeTest.pins} pins`, () => expect(node.querySelectorAll("ueb-pin")).to.be.lengthOf(nodeTest.pins))
it("Expected development", () => expect(node.entity.isDevelopmentOnly()).equals(nodeTest.development))
it("Maintains the order of attributes", () => {
getBlueprint().selectAll()
const value = getBlueprint().template.getCopyInputObject().getSerializedText()
const words = value.split("\n").map(row => row.match(/\s*(\w+(\s+\w+)*).+/)?.[1]).filter(v => v?.length > 0)