Files
ueblueprint/tests/nodeMultiply(MatrixMulVector4).spec.js
BarsDev 6ba2705386 Large refactoring and new nodes
* Fix node reference when changing elements

* Fix ScriptVariables parsing

* Fix invariant text and niagara types

* Niagara convert nodes

* Move node tests to own files

* More Niagara tests

* Niagara float and smaller fixes

* More Decoding

* More decoding

* WIP

* Float is real

* WIP

* More types and colors

* Test case and small polish

* WIP

* WIP

* Fix niagara script variables merging

* Fix Niagara variables

* Fixing mirrored ExportPath

* Fix Export paths name adjustments

* Simplify arc calculation

* Simplify a bit arc calculation

* source / destionation => origin / target

* Minor refactoring

* Fix switched link position

* Rename some properties for uniformity

* Fix input escape

* Simplify test

* About window

* Dialog backdrop style

* About dialog touches

* Remove dependency and minot improvement

* Light mode

* Fix link location and css small improvement

* Link direction and minor fixes

* Some minor fixes and refactoring

* Refactoring WIP

* Shorting repetitive bits

* More tests

* Simplify linking tests
2025-02-07 00:36:03 +02:00

62 lines
7.4 KiB
JavaScript
Executable File

import PinElement from "../js/element/PinElement.js"
import Utility from "../js/Utility.js"
import { expect, testNode } from "./fixtures/test.js"
testNode({
name: "Multiply (Matrix * Vector4)",
value: String.raw`
Begin Object Class=/Script/NiagaraEditor.NiagaraNodeOp Name="NiagaraNodeOp_92" ExportPath="/Script/NiagaraEditor.NiagaraNodeOp'/Engine/Transient.NewNiagaraScript:NiagaraScriptSource_0.NiagaraGraph_0.NiagaraNodeOp_92'"
OpName="Matrix::MatrixVectorMultiply"
ChangeId=27BF0290BEB64ADA8B924165BC1B4638
NodePosX=512
NodePosY=480
NodeGuid=597CA99BCD6540339C6EDD3F779DD5E2
CustomProperties Pin (PinId=B18A8E214AA24427AD350D7548E67682,PinName="M",PinToolTip="M",PinType.PinCategory="Type",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/Niagara.NiagaraMatrix'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="1.0,0.0,0.0,0.0,\t\t0.0,1.0,0.0,0.0,\t\t0.0,0.0,1.0,0.0,\t\t0.0,0.0,0.0,1.0",AutogeneratedDefaultValue="1.0,0.0,0.0,0.0,\t\t0.0,1.0,0.0,0.0,\t\t0.0,0.0,1.0,0.0,\t\t0.0,0.0,0.0,1.0",LinkedTo=(NiagaraNodeParameterMapGet_2 77AD8CE312C44F3996A0AF04607A4DD6,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=28E62E1F14204AD1857565EF6C7A63F3,PinName="V",PinToolTip="V",PinType.PinCategory="Type",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.Vector4f'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="22.000000,33.000000,44.000000,55.000000",AutogeneratedDefaultValue="1.0,1.0,1.0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=9A2423D0FFC945DA85DA823BD71D6BA0,PinName="Result",PinToolTip="Result",Direction="EGPD_Output",PinType.PinCategory="Type",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.Vector4f'",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,)
End Object
`,
size: [22.5, 7],
pins: 3,
pinNames: ["M", "V", "Result"],
delegate: false,
development: false,
additionalTest: async (node, pins, blueprintPage) => {
expect(await node.evaluate(node => node.classList.contains("ueb-node-style-glass"))).toBeFalsy()
expect(await node.evaluate(node => node.classList.contains("ueb-node-style-default"))).toBeTruthy()
expect(await pins[1].evaluate(/** @param {PinElement<Vector4DEntity>} pin */pin => pin.entity.DefaultValue.toArray()))
.toStrictEqual([22, 33, 44, 55])
let inputs = await pins[1].locator("ueb-input").all()
await inputs[0].fill("-1")
await inputs[1].fill("-2")
await inputs[2].fill("-3")
await inputs[3].fill("-4")
await blueprintPage.blur()
await expect(inputs[0]).toContainText("-1.0")
await expect(inputs[1]).toContainText("-2.0")
await expect(inputs[2]).toContainText("-3.0")
await expect(inputs[3]).toContainText("-4.0")
const resultSerialization = await blueprintPage.blueprintLocator.evaluate(blueprint => {
blueprint.selectAll()
return blueprint.getSerializedText()
})
const expectedSerialization = String.raw`
Begin Object Class=/Script/NiagaraEditor.NiagaraNodeOp Name="NiagaraNodeOp_92" ExportPath="/Script/NiagaraEditor.NiagaraNodeOp'/Engine/Transient.NewNiagaraScript:NiagaraScriptSource_0.NiagaraGraph_0.NiagaraNodeOp_92'"
OpName="Matrix::MatrixVectorMultiply"
ChangeId=27BF0290BEB64ADA8B924165BC1B4638
NodePosX=512
NodePosY=480
NodeGuid=597CA99BCD6540339C6EDD3F779DD5E2
CustomProperties Pin (PinId=B18A8E214AA24427AD350D7548E67682,PinName="M",PinToolTip="M",PinType.PinCategory="Type",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/Niagara.NiagaraMatrix'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="1.0,0.0,0.0,0.0,\t\t0.0,1.0,0.0,0.0,\t\t0.0,0.0,1.0,0.0,\t\t0.0,0.0,0.0,1.0",AutogeneratedDefaultValue="1.0,0.0,0.0,0.0,\t\t0.0,1.0,0.0,0.0,\t\t0.0,0.0,1.0,0.0,\t\t0.0,0.0,0.0,1.0",LinkedTo=(NiagaraNodeParameterMapGet_2 77AD8CE312C44F3996A0AF04607A4DD6,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=28E62E1F14204AD1857565EF6C7A63F3,PinName="V",PinToolTip="V",PinType.PinCategory="Type",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.Vector4f'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="-1.000000,-2.000000,-3.000000,-4.000000",AutogeneratedDefaultValue="1.0,1.0,1.0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=9A2423D0FFC945DA85DA823BD71D6BA0,PinName="Result",PinToolTip="Result",Direction="EGPD_Output",PinType.PinCategory="Type",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.Vector4f'",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,)
End Object
`
const words = expectedSerialization
.split("\n")
.map(row => row.match(/\s*("?\w+(\s+\w+)*).+/)?.[1])
.filter(v => v?.length > 0)
expect(resultSerialization).toMatch(Utility.getFirstWordOrder(words))
},
})