mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
* 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
158 lines
13 KiB
JavaScript
Executable File
158 lines
13 KiB
JavaScript
Executable File
import BlueprintFixture from "./fixtures/BlueprintFixture.js"
|
|
import { expect, test } from "./fixtures/test.js"
|
|
|
|
test.describe("Linking", () => {
|
|
|
|
test.beforeEach(async ({ blueprintPage }) => {
|
|
await blueprintPage.removeNodes()
|
|
await blueprintPage.paste(String.raw`
|
|
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_29" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Engine/Maps/Templates/NewWorld.NewWorld:PersistentLevel.NewWorld.EventGraph.K2Node_CallFunction_29'"
|
|
bIsPureFunc=True
|
|
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.KismetMathLibrary'",MemberName="MakeRotator")
|
|
NodePosX=-3152
|
|
NodePosY=-608
|
|
NodeGuid=4340FF7A779C4CD6A214350F6B196A20
|
|
CustomProperties Pin (PinId=01CEDBCB4492ACD233830FBBB7583895,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet Math Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/Engine.KismetMathLibrary'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/Engine.Default__KismetMathLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
|
CustomProperties Pin (PinId=9EF49AF4439604F146626C942630AE7F,PinName="Roll",PinFriendlyName="X (Roll)",PinToolTip="X (Roll)\nFloat (single-precision)",PinType.PinCategory="real",PinType.PinSubCategory="float",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.0",AutogeneratedDefaultValue="0.0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
|
CustomProperties Pin (PinId=C7D2429C4EC24C0D8AE6ADA672BE7C6F,PinName="Pitch",PinFriendlyName="Y (Pitch)",PinToolTip="Y (Pitch)\nFloat (single-precision)",PinType.PinCategory="real",PinType.PinSubCategory="float",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.0",AutogeneratedDefaultValue="0.0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
|
CustomProperties Pin (PinId=291C0FB3400FBFE88817D7BF71DC1FF7,PinName="Yaw",PinFriendlyName="Z (Yaw)",PinToolTip="Z (Yaw)\nFloat (single-precision)",PinType.PinCategory="real",PinType.PinSubCategory="float",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.0",AutogeneratedDefaultValue="0.0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
|
CustomProperties Pin (PinId=5BADBCF34ED86925DAA81983B5BE12B2,PinName="ReturnValue",PinToolTip="Return Value\nRotator\n\nMakes a rotator {Roll, Pitch, Yaw} from rotation values supplied in degrees",Direction="EGPD_Output",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="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
|
End Object
|
|
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_5" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Engine/Maps/Templates/NewWorld.NewWorld:PersistentLevel.NewWorld.EventGraph.K2Node_CallFunction_5'"
|
|
bIsPureFunc=True
|
|
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.KismetMathLibrary'",MemberName="GetForwardVector")
|
|
NodePosX=-2704
|
|
NodePosY=-576
|
|
NodeGuid=9BFBB662CF9642FBB9003050B5A1D394
|
|
CustomProperties Pin (PinId=E8BB6375453E11DF80EEBDBEEE1FFA23,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet Math Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/Engine.KismetMathLibrary'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/Engine.Default__KismetMathLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
|
CustomProperties Pin (PinId=EBD734BF4537F7BFDA921F932A1E67D9,PinName="InRot",PinToolTip="In Rot\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="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
|
CustomProperties Pin (PinId=C0EC34304B3A9CCCDFFE71BEE1A30949,PinName="ReturnValue",PinToolTip="Return Value\nVector\n\nRotate the world forward vector by the given rotation",Direction="EGPD_Output",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="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
|
End Object
|
|
`)
|
|
})
|
|
|
|
/** @param {BlueprintFixture} blueprintPage */
|
|
const getElements = blueprintPage => {
|
|
/** @type {Locator<PinElement>} */
|
|
const aPin = blueprintPage.blueprintLocator.locator('ueb-node:has-text("Make Rotator") ueb-pin:has-text("Return Value")')
|
|
/** @type {Locator<PinElement>} */
|
|
const bPin = blueprintPage.blueprintLocator.locator('ueb-node:has-text("Get Forward Vector") ueb-pin:has-text("In Rot")')
|
|
return { aPin, bPin }
|
|
}
|
|
|
|
test("Can connect pins", async ({ blueprintPage }) => {
|
|
const { aPin, bPin } = getElements(blueprintPage)
|
|
const aRect = await aPin.evaluate(pin => pin.getBoundingClientRect())
|
|
const bRect = await bPin.evaluate(pin => pin.getBoundingClientRect())
|
|
const mouse = blueprintPage.page.mouse
|
|
const color = await aPin.evaluate(pin => pin.entity.pinColor().toString())
|
|
expect(color).toMatch(/\d+\,\s*\d+\,\s*\d+/)
|
|
expect(await aPin.evaluate(pin => pin.entity.pinColor().toString())).toEqual(color)
|
|
expect(await aPin.evaluate(pin => pin.entity.isLinked())).toBeFalsy()
|
|
expect(await bPin.evaluate(pin => pin.entity.isLinked())).toBeFalsy()
|
|
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(0)
|
|
await aPin.hover({
|
|
position: {
|
|
x: Math.floor(aRect.width / 2),
|
|
y: Math.floor(aRect.height / 2),
|
|
}
|
|
})
|
|
await mouse.down()
|
|
await mouse.move(aRect.left + aRect.width + 100, aRect.top + aRect.height + 100, { steps: 4 })
|
|
// There is one link element ...
|
|
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(1)
|
|
// ... but no pins are linked yet
|
|
expect(await aPin.evaluate(pin => pin.entity.isLinked())).toBeFalsy()
|
|
expect(await bPin.evaluate(pin => pin.entity.isLinked())).toBeFalsy()
|
|
await bPin.hover({
|
|
position: {
|
|
x: Math.floor(bRect.width / 2),
|
|
y: Math.floor(bRect.height / 2),
|
|
}
|
|
})
|
|
await mouse.up()
|
|
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(1)
|
|
expect(await blueprintPage.blueprintLocator.locator("ueb-link").evaluate(
|
|
link => link.style.getPropertyValue("--ueb-link-color-rgb"))
|
|
)
|
|
.toEqual(color)
|
|
expect(await aPin.evaluate(pin => pin.entity.isLinked())).toBeTruthy()
|
|
expect(await bPin.evaluate(pin => pin.entity.isLinked())).toBeTruthy()
|
|
})
|
|
|
|
test("Can connect only once", async ({ blueprintPage }) => {
|
|
{
|
|
const { aPin, bPin } = getElements(blueprintPage)
|
|
const aRect = await aPin.evaluate(pin => pin.getBoundingClientRect())
|
|
const bRect = await bPin.evaluate(pin => pin.getBoundingClientRect())
|
|
const mouse = blueprintPage.page.mouse
|
|
await aPin.hover({
|
|
position: {
|
|
x: Math.floor(aRect.width / 2),
|
|
y: Math.floor(aRect.height / 2),
|
|
}
|
|
})
|
|
await mouse.down()
|
|
await mouse.move(aRect.left + aRect.width + 100, aRect.top + aRect.height + 100, { steps: 4 })
|
|
await bPin.hover({
|
|
position: {
|
|
x: Math.floor(bRect.width / 2),
|
|
y: Math.floor(bRect.height / 2),
|
|
}
|
|
})
|
|
await mouse.up()
|
|
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(1)
|
|
}
|
|
|
|
{
|
|
const { aPin, bPin } = getElements(blueprintPage)
|
|
const aRect = await aPin.evaluate(pin => pin.getBoundingClientRect())
|
|
const bRect = await bPin.evaluate(pin => pin.getBoundingClientRect())
|
|
const mouse = blueprintPage.page.mouse
|
|
await aPin.hover({
|
|
position: {
|
|
x: Math.floor(aRect.width / 2),
|
|
y: Math.floor(aRect.height / 2),
|
|
}
|
|
})
|
|
await mouse.down()
|
|
await mouse.move(aRect.left + aRect.width + 100, aRect.top + aRect.height + 100, { steps: 4 })
|
|
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(2)
|
|
await bPin.hover({
|
|
position: {
|
|
x: Math.floor(bRect.width / 2),
|
|
y: Math.floor(bRect.height / 2),
|
|
}
|
|
})
|
|
await expect(blueprintPage.blueprintLocator.locator('ueb-link[data-dragging="true"] .ueb-link-message-text'))
|
|
.toContainText("Replace existing input connections")
|
|
await mouse.up()
|
|
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(1)
|
|
}
|
|
|
|
{
|
|
const { aPin, bPin } = getElements(blueprintPage)
|
|
const aRect = await aPin.evaluate(pin => pin.getBoundingClientRect())
|
|
const bRect = await bPin.evaluate(pin => pin.getBoundingClientRect())
|
|
const mouse = blueprintPage.page.mouse
|
|
await bPin.hover({
|
|
position: {
|
|
x: Math.floor(bRect.width / 2),
|
|
y: Math.floor(bRect.height / 2),
|
|
}
|
|
})
|
|
await mouse.down()
|
|
await mouse.move(bRect.left + bRect.width + 100, bRect.top + bRect.height + 100, { steps: 4 })
|
|
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(2)
|
|
await aPin.hover({
|
|
position: {
|
|
x: Math.floor(aRect.width / 2),
|
|
y: Math.floor(aRect.height / 2),
|
|
}
|
|
})
|
|
await mouse.up()
|
|
await expect(blueprintPage.blueprintLocator.locator("ueb-link")).toHaveCount(1)
|
|
}
|
|
})
|
|
})
|