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

175 lines
13 KiB
JavaScript

import { expect, test } from "./fixtures/test.js"
const firstRowOnly = v => v.replaceAll(/^\s+|\n.+/gs, "")
test("Inner renaming", async ({ blueprintPage }) => {
blueprintPage = await blueprintPage.clone()
let source = String.raw`
Begin Object Class=/Script/PCGEditor.PCGEditorGraphNode Name="PCGEditorGraphNode_2" ExportPath=/Script/PCGEditor.PCGEditorGraphNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2"'
Begin Object Class=/Script/PCG.PCGNode Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7"'
Begin Object Class=/Script/PCG.PCGBlueprintSettings Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGBlueprintSettings_0"'
End Object
Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_0" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGPin_0"'
End Object
Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_1" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGPin_1"'
End Object
Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_2" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGPin_2"'
End Object
Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_3" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGPin_3"'
End Object
End Object
Begin Object Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7"'
Begin Object Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGBlueprintSettings_0"'
"Seed"=-1282097489
"bExposeToLibrary"=False
"CachedOverridableParams"(0)=(Label="Seed",PropertiesNames=("Seed"),PropertyClass=/Script/CoreUObject.Class'"/Script/PCG.PCGBlueprintSettings"')
End Object
End Object
End Object
`
await blueprintPage.paste(source)
expect(firstRowOnly(await blueprintPage.node.evaluate(n => n.entity.serialize()))).toEqual(
`Begin Object Class=/Script/PCGEditor.PCGEditorGraphNode Name="PCGEditorGraphNode_2" ExportPath=/Script/PCGEditor.PCGEditorGraphNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGNode Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGBlueprintSettings_PCGBlueprintSettings_0'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGBlueprintSettings Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGBlueprintSettings_0"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGPin_PCGPin_0'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_0" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGPin_0"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGPin_PCGPin_2'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_2" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGPin_2"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_ExecuteBlueprint_7'].serialize()
))).toEqual(
`Begin Object Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_ExecuteBlueprint_7']['#SubObject_PCGBlueprintSettings_0'].serialize()
))).toEqual(
`Begin Object Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.PCGEditorGraphNode_2.ExecuteBlueprint_7.PCGBlueprintSettings_0"'`
)
// Rename outer object PCGEditorGraphNode_2 -> Name1
await blueprintPage.node.evaluate(n => n.entity.Name.value = "Name1")
expect(firstRowOnly(await blueprintPage.node.evaluate(n => n.entity.serialize()))).toEqual(
`Begin Object Class=/Script/PCGEditor.PCGEditorGraphNode Name="Name1" ExportPath=/Script/PCGEditor.PCGEditorGraphNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.Name1"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGNode Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.Name1.ExecuteBlueprint_7"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGBlueprintSettings_PCGBlueprintSettings_0'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGBlueprintSettings Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.Name1.ExecuteBlueprint_7.PCGBlueprintSettings_0"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGPin_PCGPin_0'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_0" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.Name1.ExecuteBlueprint_7.PCGPin_0"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGPin_PCGPin_2'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_2" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.Name1.ExecuteBlueprint_7.PCGPin_2"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_ExecuteBlueprint_7'].serialize()
))).toEqual(
`Begin Object Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.Name1.ExecuteBlueprint_7"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_ExecuteBlueprint_7']['#SubObject_PCGBlueprintSettings_0'].serialize()
))).toEqual(
`Begin Object Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.Name1.ExecuteBlueprint_7.PCGBlueprintSettings_0"'`
)
// Rename outer object another name -> new StringEntity("another name")
await blueprintPage.node.evaluate(n => n.entity.Name = new (n.entity.constructor.attributes.Name)("another name"))
expect(firstRowOnly(await blueprintPage.node.evaluate(n => n.entity.serialize()))).toEqual(
`Begin Object Class=/Script/PCGEditor.PCGEditorGraphNode Name="another name" ExportPath=/Script/PCGEditor.PCGEditorGraphNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.another name"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGNode Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.another name.ExecuteBlueprint_7"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGBlueprintSettings_PCGBlueprintSettings_0'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGBlueprintSettings Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.another name.ExecuteBlueprint_7.PCGBlueprintSettings_0"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGPin_PCGPin_0'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_0" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.another name.ExecuteBlueprint_7.PCGPin_0"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGPin_PCGPin_2'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_2" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.another name.ExecuteBlueprint_7.PCGPin_2"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_ExecuteBlueprint_7'].serialize()
))).toEqual(
`Begin Object Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.another name.ExecuteBlueprint_7"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_ExecuteBlueprint_7']['#SubObject_PCGBlueprintSettings_0'].serialize()
))).toEqual(
`Begin Object Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1.another name.ExecuteBlueprint_7.PCGBlueprintSettings_0"'`
)
// Rename outer object another name -> null
await blueprintPage.node.evaluate(n => n.entity.Name = null)
expect(firstRowOnly(await blueprintPage.node.evaluate(n => n.entity.serialize()))).toEqual(
`Begin Object Class=/Script/PCGEditor.PCGEditorGraphNode ExportPath=/Script/PCGEditor.PCGEditorGraphNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1."'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGNode Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1..ExecuteBlueprint_7"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGBlueprintSettings_PCGBlueprintSettings_0'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGBlueprintSettings Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1..ExecuteBlueprint_7.PCGBlueprintSettings_0"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGPin_PCGPin_0'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_0" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1..ExecuteBlueprint_7.PCGPin_0"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_/Script/PCG.PCGNode_ExecuteBlueprint_7']['#SubObject_/Script/PCG.PCGPin_PCGPin_2'].serialize()
))).toEqual(
`Begin Object Class=/Script/PCG.PCGPin Name="PCGPin_2" ExportPath=/Script/PCG.PCGPin'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1..ExecuteBlueprint_7.PCGPin_2"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_ExecuteBlueprint_7'].serialize()
))).toEqual(
`Begin Object Name="ExecuteBlueprint_7" ExportPath=/Script/PCG.PCGNode'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1..ExecuteBlueprint_7"'`
)
expect(firstRowOnly(await blueprintPage.node.evaluate(n =>
n.entity['#SubObject_ExecuteBlueprint_7']['#SubObject_PCGBlueprintSettings_0'].serialize()
))).toEqual(
`Begin Object Name="PCGBlueprintSettings_0" ExportPath=/Script/PCG.PCGBlueprintSettings'"/Game/NewPCGGraph.NewPCGGraph:PCGEditorGraph_1..ExecuteBlueprint_7.PCGBlueprintSettings_0"'`
)
blueprintPage.cleanup()
})