Files
ueblueprint/tests/nodeAddLocalNavigationGridForBox.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

83 lines
11 KiB
JavaScript
Executable File

import Configuration from "../js/Configuration.js"
import SVGIcon from "../js/SVGIcon.js"
import { expect, testNode } from "./fixtures/test.js"
testNode({
name: "Add Local Navigation Grid For Box",
value: String.raw`
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_0" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Temp/Untitled_1.Untitled_1:PersistentLevel.Untitled.EventGraph.K2Node_CallFunction_0'"
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/AIModule.NavLocalGridManager'",MemberName="AddLocalNavigationGridForBox")
NodePosX=304
NodePosY=-496
NodeGuid=C15FC9905D6D4BF5AF19CB81BAB598DE
CustomProperties Pin (PinId=4A315083206E46F38782139225D1CBDB,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=0E0D6F8DD32C430D9F727D4B16A6CA85,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=3A0F065EA4444A6BBD9DB667859A2139,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nNav Local Grid Manager Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/AIModule.NavLocalGridManager'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/AIModule.Default__NavLocalGridManager",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=3FBC998EDAF84DC48EF01354ED460934,PinName="WorldContextObject",PinToolTip="World Context Object\nObject Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/CoreUObject.Object'",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=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=44559846BCBA449395FE1552F1ECE478,PinName="Location",PinToolTip="Location\nVector (by ref)",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.Vector'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=True,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=C5C95F7DF3A74AF990B3093D85D70478,PinName="Extent",PinToolTip="Extent\nVector",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.Vector'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="15.000000,30.000000,45.000000",AutogeneratedDefaultValue="1.000000,1.000000,1.000000",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=EE0E7856A7B54B5CBE67E4F589E82B4C,PinName="Rotation",PinToolTip="Rotation\nRotator",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/CoreUObject.Rotator'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="20.000000,30.000000,10.000000",AutogeneratedDefaultValue="0, 0, 0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=960A2A37701047D5B28353189B7199A5,PinName="Radius2D",PinToolTip="Radius 2D\nInteger",PinType.PinCategory="int",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="8",AutogeneratedDefaultValue="5",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=DE5301DC038D43969F9DB9F41949AFD0,PinName="Height",PinToolTip="Height\nFloat (single-precision)",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="200.500000",AutogeneratedDefaultValue="100.000000",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=5E42C9BD542E413E9CEF9D5A98A4C5EB,PinName="bRebuildGrids",PinToolTip="Rebuild Grids\nBoolean",PinType.PinCategory="bool",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,DefaultValue="false",AutogeneratedDefaultValue="true",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=5A398222D44740A98F9742B5BDDB3580,PinName="ReturnValue",PinToolTip="Return Value\nInteger\n\nAdd Local Navigation Grid for Box",Direction="EGPD_Output",PinType.PinCategory="int",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,DefaultValue="0",AutogeneratedDefaultValue="0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
`,
size: [20.5, 19],
color: Configuration.nodeColors.blue,
icon: SVGIcon.functionSymbol,
pins: 9,
pinNames: [
"Location",
"Extent",
"Rotation",
"Radius 2D",
"Height",
"Rebuild Grids",
"Return Value",
],
delegate: false,
development: false,
additionalTest: async (node, pins, blueprintPage) => {
await expect(pins[2].locator("ueb-input")).toHaveText(["15.0", "30.0", "45.0"])
await expect(pins[3].locator("ueb-input")).toHaveText(["10.0", "20.0", "30.0"])
await expect(pins[4].locator("ueb-input")).toHaveText(["8"])
await expect(pins[5].locator("ueb-input")).toHaveText(["200.5"])
await expect(pins[6].locator("input")).toBeChecked({ checked: false })
let inputs = await pins[2].locator("ueb-input").all()
await inputs[0].fill("-11.11")
await inputs[1].fill("-22.22")
await inputs[2].fill("-33.33")
await blueprintPage.blur()
expect(await pins[2].evaluate(pin => pin.entity.DefaultValue.constructor.className()))
.toBe("SimpleSerializationVectorEntity")
await expect(pins[2].locator("ueb-input")).toHaveText(["-11.11", "-22.22", "-33.33"])
inputs = await pins[3].locator("ueb-input").all()
await inputs[0].fill("88")
await inputs[1].fill("77")
await inputs[2].fill("66")
await blueprintPage.blur()
expect(await pins[3].evaluate(pin => pin.entity.DefaultValue.constructor.className()))
.toBe("SimpleSerializationRotatorEntity")
await expect(pins[3].locator("ueb-input")).toHaveText(["88.0", "77.0", "66.0"])
await pins[4].locator("ueb-input").fill("35.814")
await blueprintPage.blur()
expect(await pins[4].evaluate(pin => pin.entity.DefaultValue.constructor.className()))
.toBe("IntegerEntity")
await expect(pins[4].locator("ueb-input")).toHaveText("35")
await pins[6].locator("input").check()
await expect(pins[6].locator("input")).toBeChecked()
expect(await pins[6].evaluate(pin => pin.entity.DefaultValue.constructor.className()))
.toBe("BooleanEntity")
const serialization = await blueprintPage.getSerializedNodes()
await blueprintPage.removeNodes()
await blueprintPage.paste(serialization)
pins = await blueprintPage.blueprintLocator.locator("ueb-pin").all()
await expect(pins[2].locator("ueb-input")).toHaveText(["-11.11", "-22.22", "-33.33"])
await expect(pins[3].locator("ueb-input")).toHaveText(["88.0", "77.0", "66.0"])
await expect(pins[4].locator("ueb-input")).toHaveText(["35"])
await expect(pins[5].locator("ueb-input")).toHaveText(["200.5"])
await expect(pins[6].locator("input")).toBeChecked()
}
})