mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-18 19:47:32 +08:00
Refactoring entities (#23)
* Still WIP * WIP * ArrayEntity parsing fixed * Fix format text entity * Tests for various entity classes and update entity class implementations * More tests and fixed * More entities fixed * Simple entities serialization fixed * Entities tests fixed * Remove serialization bits * Fix Function reference * CustomProperties creating fixed * WIP * Better typing for grammars * Decoding code fixes * Fixing still * Several fixes * rename toString to serialize * Several fixes * More fixes * Moving more stuff out of Utility * Several fixes * Fixing Linear color entity print * Serialization fixes * Fix serialization * Method to compute grammar * Renaming fix * Fix array grammar and equality check * Fix inlined keys * Fix type * Several serialization fixes * Fix undefined dereference * Several fixes * More fixes and cleanup * Fix keys quoting mechanism * Fix natural number assignment * Fix Int64 toString() * Fix quoted keys for inlined arrays * Fix PG pins * Fix several test cases * Types fixes * New pin default value empty * Fix non existing DefaultValue for variadic nodes * Smaller fixes for crashes * Fix link color when attached to knot * Linking test and more reliability operations for adding pins * Improve issue 18 test * More tests and fixes * Fix enum pin entity * Remove failing test
This commit is contained in:
@@ -41,26 +41,24 @@ export default class IssuesNodes1 extends NodeTests {
|
||||
delegate: false,
|
||||
development: false,
|
||||
additionalTest: async (node, pins, blueprintPage) => {
|
||||
const relevantPins = (await Promise.all(
|
||||
pins.map(async p => {
|
||||
const innerText = await p.innerText()
|
||||
// @ts-expect-error
|
||||
return [Configuration.rgba.includes(innerText), p]
|
||||
})
|
||||
))
|
||||
.filter(([flag, value]) => flag)
|
||||
.map(([flag, value]) => /** @type {Locator<PinElement>} */(value))
|
||||
expect(await Promise.all(relevantPins.map(async pin => await pin.innerText()))).toStrictEqual(Configuration.rgba)
|
||||
for (const p of relevantPins) {
|
||||
const pinName = await p.innerText()
|
||||
expect(p.locator('input[type="checkbox"]')).toBeChecked({ checked: pinName === "R" })
|
||||
const relevantPins = []
|
||||
for (const pin of pins) {
|
||||
const innerText = await pin.innerText()
|
||||
if (Configuration.rgba.includes(innerText)) {
|
||||
relevantPins.push(pin)
|
||||
}
|
||||
}
|
||||
for (const pin of relevantPins) {
|
||||
const pinName = await pin.innerText()
|
||||
// Only pin R is checked
|
||||
await expect(pin.locator('input[type="checkbox"]')).toBeChecked({ checked: pinName === "R" })
|
||||
}
|
||||
await relevantPins[0].locator('input[type="checkbox"]').uncheck() // Uncheck "R"
|
||||
await relevantPins[2].locator('input[type="checkbox"]').check() // Check "B"
|
||||
await relevantPins[3].locator('input[type="checkbox"]').check() // Check "A"
|
||||
await relevantPins[2].locator('input[type="checkbox"]').uncheck() // Uncheck "B"
|
||||
await relevantPins[2].locator('input[type="checkbox"]').check() // Check "B"
|
||||
expect(node.locator(".ueb-node-name")).toHaveText("Mask ( B A )")
|
||||
await expect(node.locator(".ueb-node-name")).toHaveText("Mask ( B A )")
|
||||
const resultSerialization = await blueprintPage.blueprintLocator.evaluate(blueprint => {
|
||||
blueprint.selectAll()
|
||||
return blueprint.template.getCopyInputObject().getSerializedText()
|
||||
@@ -97,6 +95,49 @@ export default class IssuesNodes1 extends NodeTests {
|
||||
expect(resultSerialization).toMatch(Utility.getFirstWordOrder(words))
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Issue 21",
|
||||
title: "Subtract(1,1)",
|
||||
value: String.raw`
|
||||
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_202" ExportPath=/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.卡通:MaterialGraph_0.MaterialGraphNode_202'
|
||||
Begin Object Class=/Script/Engine.MaterialExpressionSubtract Name="MaterialExpressionSubtract_10" ExportPath=/Script/Engine.MaterialExpressionSubtract'/Engine/Transient.卡通:MaterialGraph_0.MaterialGraphNode_202.MaterialExpressionSubtract_10'
|
||||
End Object
|
||||
Begin Object Name="MaterialExpressionSubtract_10" ExportPath=/Script/Engine.MaterialExpressionSubtract'/Engine/Transient.卡通:MaterialGraph_0.MaterialGraphNode_202.MaterialExpressionSubtract_10'
|
||||
A=(Expression="/Script/Engine.MaterialExpressionSaturate'MaterialGraphNode_237.MaterialExpressionSaturate_3'")
|
||||
B=(Expression="/Script/Engine.MaterialExpressionSaturate'MaterialGraphNode_201.MaterialExpressionSaturate_7'")
|
||||
MaterialExpressionEditorX=0
|
||||
MaterialExpressionEditorY=0
|
||||
MaterialExpressionGuid=7202C13642DA1225C118CF867599387C
|
||||
Material="/Script/UnrealEd.PreviewMaterial'/Engine/Transient.卡通'"
|
||||
End Object
|
||||
MaterialExpression=/Script/Engine.MaterialExpressionSubtract'MaterialExpressionSubtract_10'
|
||||
NodePosX=0
|
||||
NodePosY=0
|
||||
NodeGuid=7008F5AC49E8F5BFD4C707819A58C021
|
||||
CustomProperties Pin (PinId=86D4DE5E48C71A576ED0519B982907B3,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="red",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="1",LinkedTo=(),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=5C75E1374E1E7436C72B9FA072875C04,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="red",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="1",LinkedTo=(),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=528D346A49976B0854764CA755AF2F93,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",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,LinkedTo=(),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object
|
||||
`,
|
||||
size: [8, 6],
|
||||
color: Configuration.nodeColors.green,
|
||||
icon: null,
|
||||
pins: 3,
|
||||
pinNames: ["A", "B"],
|
||||
delegate: false,
|
||||
development: false,
|
||||
additionalTest: async (node, pins, blueprintPage) => {
|
||||
await expect(pins[0].locator("ueb-input")).toHaveText("1.0")
|
||||
await expect(pins[1].locator("ueb-input")).toHaveText("1.0")
|
||||
let inputs = await node.locator("ueb-input").all()
|
||||
await inputs[0].fill("-8")
|
||||
await blueprintPage.blur()
|
||||
expect(await node.evaluate(n => n.nodeDisplayName)).toEqual("Subtract(-8,1)")
|
||||
await inputs[1].fill("9.2")
|
||||
await blueprintPage.blur()
|
||||
expect(await node.evaluate(n => n.nodeDisplayName)).toEqual("Subtract(-8,9.2)")
|
||||
}
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user