mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-16 02:10:38 +08:00
More Niagara tests
This commit is contained in:
310
tests/fixtures/test.js
vendored
310
tests/fixtures/test.js
vendored
@@ -47,156 +47,168 @@ export * from "@playwright/test"
|
||||
|
||||
/** @param {TestData} testData */
|
||||
export function testNode(testData) {
|
||||
test.describe(testData.name, () => {
|
||||
|
||||
test.beforeAll(async ({ blueprintPage }) => {
|
||||
await blueprintPage.removeNodes()
|
||||
await blueprintPage.paste(testData.value)
|
||||
})
|
||||
|
||||
testData.title ??= testData.name
|
||||
|
||||
if (testData.color) {
|
||||
test(
|
||||
`${testData.name}: Has correct color`,
|
||||
async ({ blueprintPage }) => {
|
||||
expect(
|
||||
await blueprintPage.node.evaluate(node => node.entity.nodeColor().toString())
|
||||
).toBe(testData.color.toString())
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
test(
|
||||
`${testData.name}: Has correct delegate`,
|
||||
async ({ blueprintPage }) => {
|
||||
const delegate = blueprintPage.blueprintLocator.locator(
|
||||
'ueb-node .ueb-node-top ueb-pin[data-type="delegate"]'
|
||||
)
|
||||
if (testData.delegate) {
|
||||
await expect(delegate).toBeVisible()
|
||||
} else {
|
||||
await expect(delegate).toBeHidden()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
test(
|
||||
`${testData.name}: Has title ${testData.title}`,
|
||||
async ({ blueprintPage }) => expect(
|
||||
await blueprintPage.node.evaluate(node => node.nodeDisplayName)
|
||||
).toBe(testData.title)
|
||||
)
|
||||
|
||||
if (testData.subtitle) {
|
||||
test(
|
||||
`${testData.name}: Has expected subtitle ${testData.subtitle}`,
|
||||
async ({ blueprintPage }) => await expect(blueprintPage.node.locator(".ueb-node-subtitle-text"))
|
||||
.toHaveText(testData.subtitle, { useInnerText: true })
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.size) {
|
||||
test(
|
||||
`${testData.name}: Has approximately the expected size`,
|
||||
async ({ blueprintPage }) => {
|
||||
const expectedSize = await blueprintPage.node.evaluate(
|
||||
(node, gridSize) => {
|
||||
const bounding = node.getBoundingClientRect()
|
||||
const expectedSize = [bounding.width / gridSize, bounding.height / gridSize]
|
||||
return expectedSize
|
||||
},
|
||||
Configuration.gridSize
|
||||
)
|
||||
expect(Math.abs(testData.size[0] - expectedSize[0])).toBeLessThanOrEqual(1.5)
|
||||
expect(Math.abs(testData.size[1] - expectedSize[1])).toBeLessThanOrEqual(1.5)
|
||||
if (
|
||||
Math.abs(testData.size[0] - expectedSize[0]) > 0.6
|
||||
|| Math.abs(testData.size[1] - expectedSize[1]) > 0.6
|
||||
) {
|
||||
console.error(`Node "${testData.name}" size does not match`)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.icon !== undefined) {
|
||||
test(
|
||||
`${testData.name}: Has the correct icon`,
|
||||
async ({ blueprintPage }) => expect(
|
||||
await blueprintPage.node.evaluate(
|
||||
node => node.entity.nodeIcon()?.strings.join("")
|
||||
)
|
||||
).toBe(testData.icon?.strings.join(""))
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.pins !== undefined) {
|
||||
test(
|
||||
`${testData.name}: Has ${testData.pins} pins`,
|
||||
async ({ blueprintPage }) => expect(
|
||||
await blueprintPage.node.evaluate(
|
||||
node => node.querySelectorAll("ueb-pin").length
|
||||
)
|
||||
).toBe(testData.pins)
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.pinNames) {
|
||||
test(
|
||||
`${testData.name}: Has correct pin names`,
|
||||
async ({ blueprintPage }) => {
|
||||
const innerTexts = await blueprintPage.node.locator(".ueb-pin-content .ueb-pin-name").allInnerTexts()
|
||||
const pinNames = innerTexts.map(v => v.trim()).filter(v => v.length > 0)
|
||||
expect(pinNames).toStrictEqual(testData.pinNames)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
test(
|
||||
`${testData.name}: Expected development`,
|
||||
async ({ blueprintPage }) => expect(
|
||||
await blueprintPage.node.evaluate(node => node.entity.isDevelopmentOnly())
|
||||
).toBe(testData.development)
|
||||
)
|
||||
|
||||
test(
|
||||
`${testData.name}: Maintains the order of attributes`,
|
||||
async ({ blueprintPage }) => {
|
||||
const actualSerialization = await blueprintPage.getSerializedNodes()
|
||||
const expectedWords = testData.value
|
||||
.split("\n")
|
||||
.map(row => row.match(/\s*("?\w+(\s+\w+)*).+/)?.[1])
|
||||
.filter(v => v?.length > 0)
|
||||
expect(actualSerialization).toMatch(Utility.getFirstWordOrder(expectedWords))
|
||||
}
|
||||
)
|
||||
|
||||
if (testData.variadic) {
|
||||
test(
|
||||
`${testData.name}: Can add new pins`,
|
||||
async ({ blueprintPage }) => {
|
||||
const variadic = blueprintPage.node.getByText("Add pin")
|
||||
await expect(variadic).toBeVisible()
|
||||
await variadic.hover()
|
||||
await variadic.click()
|
||||
expect(await blueprintPage.node.locator("ueb-pin").all()).toHaveLength(testData.pins + 1)
|
||||
await variadic.blur()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.additionalTest) {
|
||||
test(
|
||||
`${testData.name}: Additional tests`,
|
||||
async ({ blueprintPage }) =>
|
||||
testData.additionalTest(
|
||||
blueprintPage.node,
|
||||
await blueprintPage.node.locator("ueb-pin").all(),
|
||||
blueprintPage,
|
||||
)
|
||||
)
|
||||
}
|
||||
test.beforeAll(async ({ blueprintPage }) => {
|
||||
await blueprintPage.removeNodes()
|
||||
await blueprintPage.paste(testData.value)
|
||||
})
|
||||
|
||||
testData.title ??= testData.name
|
||||
|
||||
if (testData.color) {
|
||||
test(
|
||||
`${testData.name}: Has correct color`,
|
||||
async ({ blueprintPage }) => {
|
||||
expect(
|
||||
await blueprintPage.node.evaluate(node => node.entity.nodeColor().toString())
|
||||
).toBe(testData.color.toString())
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
test(
|
||||
`${testData.name}: Has correct delegate`,
|
||||
async ({ blueprintPage }) => {
|
||||
const delegate = blueprintPage.blueprintLocator.locator(
|
||||
'ueb-node .ueb-node-top ueb-pin[data-type="delegate"]'
|
||||
)
|
||||
if (testData.delegate) {
|
||||
await expect(delegate).toBeVisible()
|
||||
} else {
|
||||
await expect(delegate).toBeHidden()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
test(
|
||||
`${testData.name}: Has title ${testData.title}`,
|
||||
async ({ blueprintPage }) => expect(
|
||||
await blueprintPage.node.evaluate(node => node.nodeDisplayName)
|
||||
).toBe(testData.title)
|
||||
)
|
||||
|
||||
if (testData.subtitle) {
|
||||
test(
|
||||
`${testData.name}: Has expected subtitle ${testData.subtitle}`,
|
||||
async ({ blueprintPage }) => await expect(blueprintPage.node.locator(".ueb-node-subtitle-text"))
|
||||
.toHaveText(testData.subtitle, { useInnerText: true })
|
||||
)
|
||||
} else {
|
||||
test(
|
||||
`${testData.name}: Has no subtitle`,
|
||||
async ({ blueprintPage }) => await expect(blueprintPage.node.locator(".ueb-node-subtitle-text"))
|
||||
.toBeHidden()
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.size) {
|
||||
test(
|
||||
`${testData.name}: Has approximately the expected size`,
|
||||
async ({ blueprintPage }) => {
|
||||
const expectedSize = await blueprintPage.node.evaluate(
|
||||
(node, gridSize) => {
|
||||
const bounding = node.getBoundingClientRect()
|
||||
const expectedSize = [bounding.width / gridSize, bounding.height / gridSize]
|
||||
return expectedSize
|
||||
},
|
||||
Configuration.gridSize
|
||||
)
|
||||
expect(Math.abs(testData.size[0] - expectedSize[0])).toBeLessThanOrEqual(1.5)
|
||||
expect(Math.abs(testData.size[1] - expectedSize[1])).toBeLessThanOrEqual(1.5)
|
||||
if (
|
||||
Math.abs(testData.size[0] - expectedSize[0]) > 0.6
|
||||
|| Math.abs(testData.size[1] - expectedSize[1]) > 0.6
|
||||
) {
|
||||
console.error(`Node "${testData.name}" size does not match`)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.icon) {
|
||||
test(
|
||||
`${testData.name}: Has the correct icon`,
|
||||
async ({ blueprintPage }) => expect(
|
||||
await blueprintPage.node.evaluate(
|
||||
node => node.entity.nodeIcon()?.strings.join("")
|
||||
)
|
||||
).toBe(testData.icon?.strings.join(""))
|
||||
)
|
||||
} else if (testData.icon === null) {
|
||||
test(
|
||||
`${testData.name}: Has no icon`,
|
||||
async ({ blueprintPage }) => expect(
|
||||
await blueprintPage.node.evaluate(
|
||||
node => node.entity.nodeIcon()
|
||||
)
|
||||
).toBeNull()
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.pins !== undefined) {
|
||||
test(
|
||||
`${testData.name}: Has ${testData.pins} pins`,
|
||||
async ({ blueprintPage }) => expect(
|
||||
await blueprintPage.node.evaluate(
|
||||
node => node.querySelectorAll("ueb-pin").length
|
||||
)
|
||||
).toBe(testData.pins)
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.pinNames) {
|
||||
test(
|
||||
`${testData.name}: Has correct pin names`,
|
||||
async ({ blueprintPage }) => {
|
||||
const innerTexts = await blueprintPage.node.locator(".ueb-pin-content .ueb-pin-name").allInnerTexts()
|
||||
const pinNames = innerTexts.map(v => v.trim()).filter(v => v.length > 0)
|
||||
expect(pinNames).toStrictEqual(testData.pinNames)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
test(
|
||||
`${testData.name}: Expected development`,
|
||||
async ({ blueprintPage }) => expect(
|
||||
await blueprintPage.node.evaluate(node => node.entity.isDevelopmentOnly())
|
||||
).toBe(testData.development)
|
||||
)
|
||||
|
||||
test(
|
||||
`${testData.name}: Maintains the order of attributes`,
|
||||
async ({ blueprintPage }) => {
|
||||
const actualSerialization = await blueprintPage.getSerializedNodes()
|
||||
const expectedWords = testData.value
|
||||
.split("\n")
|
||||
.map(row => row.match(/\s*("?\w+(\s+\w+)*).+/)?.[1])
|
||||
.filter(v => v?.length > 0)
|
||||
expect(actualSerialization).toMatch(Utility.getFirstWordOrder(expectedWords))
|
||||
}
|
||||
)
|
||||
|
||||
if (testData.variadic) {
|
||||
test(
|
||||
`${testData.name}: Can add new pins`,
|
||||
async ({ blueprintPage }) => {
|
||||
const variadic = blueprintPage.node.getByText("Add pin")
|
||||
await expect(variadic).toBeVisible()
|
||||
await variadic.hover()
|
||||
await variadic.click()
|
||||
expect(await blueprintPage.node.locator("ueb-pin").all()).toHaveLength(testData.pins + 1)
|
||||
await variadic.blur()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (testData.additionalTest) {
|
||||
test(
|
||||
`${testData.name}: Additional tests`,
|
||||
async ({ blueprintPage }) =>
|
||||
testData.additionalTest(
|
||||
blueprintPage.node,
|
||||
await blueprintPage.node.locator("ueb-pin").all(),
|
||||
blueprintPage,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ testNode({
|
||||
CustomProperties Pin (PinId=88182FCB4DE7B6D80AD1B79906069691,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "BaseMCDelegateSelfPinName", "Target"),PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/Engine.BlueprintGeneratedClass'"/PCG/BP_Elements/PCGAsset.PCGAsset_C"',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: [13.5, 6],
|
||||
color: Configuration.nodeColors.blue,
|
||||
icon: SVGIcon.node,
|
||||
pins: 3,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import PinElement from "../js/element/PinElement.js"
|
||||
import NumberEntity from "../js/entity/NumberEntity.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import PinElement from "../js/element/PinElement.js"
|
||||
import NumberEntity from "../js/entity/NumberEntity.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import PinElement from "../js/element/PinElement.js"
|
||||
import NumberEntity from "../js/entity/NumberEntity.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import PinElement from "../js/element/PinElement.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
|
||||
28
tests/nodeCopyPayload.spec.js
Normal file
28
tests/nodeCopyPayload.spec.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import SVGIcon from "../js/SVGIcon.js"
|
||||
import { testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
name: "Copy Payload",
|
||||
value: String.raw`
|
||||
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_0" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Engine/Maps/Templates/NewEditorUtilityBlueprint.NewEditorUtilityBlueprint:NewFunction.K2Node_CallFunction_0'"
|
||||
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.AnimationDataModelNotifiesExtensions'",MemberName="CopyPayload")
|
||||
NodePosX=-624
|
||||
NodePosY=224
|
||||
NodeGuid=A3F89A4516E64DF89CFD2A53F14A8BF7
|
||||
CustomProperties Pin (PinId=3EBC7147C5E74160A63ED4B20541B11C,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=E611C1C002DA4E88833EF4E18018DE29,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=7EAB5C36979142AE9CC0C1EC06988D82,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nAnimation Data Model Notifies Extensions Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/Engine.AnimationDataModelNotifiesExtensions'",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__AnimationDataModelNotifiesExtensions",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=C195EDB3B4904220A87E2E211E876787,PinName="Payload",PinToolTip="Payload\nAnim Data Model Notif Payload Structure (by ref)",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/Engine.AnimDataModelNotifPayload'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=True,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=BBD426289F74416D98B160B163A715B2,PinName="ExpectedStruct",PinToolTip="Expected Struct\nScript Struct Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/CoreUObject.ScriptStruct'",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=377DFCDE9F154E10BE14955375E29365,PinName="OutPayload",PinToolTip="Out Payload\nEmpty Payload Structure (by ref)",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.ScriptStruct'/Script/Engine.EmptyPayload'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,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: [14.5, 11],
|
||||
color: Configuration.nodeColors.blue,
|
||||
icon: SVGIcon.functionSymbol,
|
||||
pins: 5,
|
||||
pinNames: ["Payload", "Expected Struct", "Out Payload"],
|
||||
delegate: false,
|
||||
development: false,
|
||||
})
|
||||
17
tests/nodeEmitter.Determinism.spec.js
Normal file
17
tests/nodeEmitter.Determinism.spec.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import { testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
name: "Emitter.Determinism",
|
||||
value: String.raw`
|
||||
Begin Object Class=/Script/NiagaraEditor.NiagaraClipboardContent Name="NiagaraClipboardContent_10" ExportPath="/Script/NiagaraEditor.NiagaraClipboardContent'/Engine/Transient.NiagaraClipboardContent_10'"
|
||||
ExportedNodes="QmVnaW4gT2JqZWN0IENsYXNzPS9TY3JpcHQvTmlhZ2FyYUVkaXRvci5OaWFnYXJhTm9kZUlucHV0IE5hbWU9Ik5pYWdhcmFOb2RlSW5wdXRfNDYiIEV4cG9ydFBhdGg9Ii9TY3JpcHQvTmlhZ2FyYUVkaXRvci5OaWFnYXJhTm9kZUlucHV0Jy9FbmdpbmUvVHJhbnNpZW50Lk5ld05pYWdhcmFTY3JpcHQ6TmlhZ2FyYVNjcmlwdFNvdXJjZV8wLk5pYWdhcmFHcmFwaF8wLk5pYWdhcmFOb2RlSW5wdXRfNDYnIgogICBJbnB1dD0oTmFtZT0iRW1pdHRlci5EZXRlcm1pbmlzbSIsVHlwZURlZkhhbmRsZT0oUmVnaXN0ZXJlZFR5cGVJbmRleD04MikpDQogICBVc2FnZT1TeXN0ZW1Db25zdGFudA0KICAgQ2hhbmdlSWQ9MjY3NDNBNzU3MDVENDdGMDlENENBMzlCOEM3N0Y2NDUNCiAgIE5vZGVQb3NYPTIwOA0KICAgTm9kZVBvc1k9LTQzMg0KICAgTm9kZUd1aWQ9M0YzMkJDMjEy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|
||||
delegate: false,
|
||||
development: false,
|
||||
})
|
||||
@@ -1,3 +1,4 @@
|
||||
import PinElement from "../js/element/PinElement.js"
|
||||
import Utility from "../js/Utility.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import PinElement from "../js/element/PinElement.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
|
||||
17
tests/nodeTranslator.CallID.spec.js
Normal file
17
tests/nodeTranslator.CallID.spec.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import Configuration from "../js/Configuration.js"
|
||||
import { testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
name: "Translator.CallID",
|
||||
value: String.raw`
|
||||
Begin Object Class=/Script/NiagaraEditor.NiagaraClipboardContent Name="NiagaraClipboardContent_2" ExportPath="/Script/NiagaraEditor.NiagaraClipboardContent'/Engine/Transient.NiagaraClipboardContent_2'"
|
||||
ExportedNodes="QmVnaW4gT2JqZWN0IENsYXNzPS9TY3JpcHQvTmlhZ2FyYUVkaXRvci5OaWFnYXJhTm9kZUlucHV0IE5hbWU9Ik5pYWdhcmFOb2RlSW5wdXRfNTIiIEV4cG9ydFBhdGg9Ii9TY3JpcHQvTmlhZ2FyYUVkaXRvci5OaWFnYXJhTm9kZUlucHV0Jy9FbmdpbmUvVHJhbnNpZW50Lk5ld05pYWdhcmFTY3JpcHQ6TmlhZ2FyYVNjcmlwdFNvdXJjZV8wLk5pYWdhcmFHcmFwaF8wLk5pYWdhcmFOb2RlSW5wdXRfNTInIgogICBJbnB1dD0oTmFtZT0iVHJhbnNsYXRvci5DYWxsSUQiLFR5cGVEZWZIYW5kbGU9KFJlZ2lzdGVyZWRUeXBlSW5kZXg9ODEpKQ0KICAgVXNhZ2U9VHJhbnNsYXRvckNvbnN0YW50DQogICBFeHBvc3VyZU9wdGlvbnM9KGJFeHBvc2VkPUZhbH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VmFsdWVJc0lnbm9yZWQ9RmFsc2UsYkFkdmFuY2VkVmlldz1GYWxzZSxiT3JwaGFuZWRQaW49RmFsc2UsKQ0KRW5kIE9iamVjdA0K"
|
||||
End Object
|
||||
`,
|
||||
color: Configuration.nodeColors.gray,
|
||||
icon: null,
|
||||
pins: 1,
|
||||
pinNames: ["Input"],
|
||||
delegate: false,
|
||||
development: false,
|
||||
})
|
||||
43
tests/nodeUseDepthBiasedAlpha.spec.js
Normal file
43
tests/nodeUseDepthBiasedAlpha.spec.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import SVGIcon from "../js/SVGIcon.js"
|
||||
import { expect, testNode } from "./fixtures/test.js"
|
||||
|
||||
testNode({
|
||||
name: "UseDepthBiasedAlpha",
|
||||
value: String.raw`
|
||||
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_1" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.M_EV_FalloffSphere_Master_01:MaterialGraph_0.MaterialGraphNode_1'"
|
||||
Begin Object Class=/Script/Engine.MaterialExpressionStaticSwitchParameter Name="MaterialExpressionStaticSwitchParameter_0" ExportPath="/Script/Engine.MaterialExpressionStaticSwitchParameter'/Engine/Transient.M_EV_FalloffSphere_Master_01:MaterialGraph_0.MaterialGraphNode_1.MaterialExpressionStaticSwitchParameter_0'"
|
||||
End Object
|
||||
Begin Object Name="MaterialExpressionStaticSwitchParameter_0" ExportPath="/Script/Engine.MaterialExpressionStaticSwitchParameter'/Engine/Transient.M_EV_FalloffSphere_Master_01:MaterialGraph_0.MaterialGraphNode_1.MaterialExpressionStaticSwitchParameter_0'"
|
||||
A=(Expression="/Script/Engine.MaterialExpressionDepthFade'MaterialExpressionDepthFade_14'")
|
||||
B=(Expression="/Script/Engine.MaterialExpressionClamp'MaterialExpressionClamp_4'")
|
||||
ParameterName="UseDepthBiasedAlpha"
|
||||
ExpressionGUID=A98669E9462B7E6612CF93B055A7A463
|
||||
MaterialExpressionEditorX=-192
|
||||
MaterialExpressionEditorY=80
|
||||
MaterialExpressionGuid=9D794A6744E0E3E14AE3D591EDA26066
|
||||
Material="/Script/UnrealEd.PreviewMaterial'/Engine/Transient.M_EV_FalloffSphere_Master_01'"
|
||||
End Object
|
||||
MaterialExpression="/Script/Engine.MaterialExpressionStaticSwitchParameter'MaterialExpressionStaticSwitchParameter_0'"
|
||||
NodePosX=-192
|
||||
NodePosY=80
|
||||
bCanRenameNode=True
|
||||
NodeGuid=89C3972A02314DC8A228AB85296ECA16
|
||||
CustomProperties Pin (PinId=23E012B58ADF4CF68CA0999863D5163F,PinName="True",PinType.PinCategory="required",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=(MaterialGraphNode_22 D118252F518B41C6A3C0547D4373C8D2,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=284ACC75E7314F9CBD42D10EF5FBD72E,PinName="False",PinType.PinCategory="required",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=(MaterialGraphNode_3 25011B470F774D60A90AAF331D1D007D,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=DA812709AA7249B5B20C36C2B9416C05,PinName="Default Value",PinType.PinCategory="optional",PinType.PinSubCategory="bool",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",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=True,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=DF5352C192C74D44A5C0ABEEA4676022,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=(MaterialGraphNode_Root_0 5174BC871BCF4E68A56F055BCFD12053,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object
|
||||
`,
|
||||
size: [11, 9],
|
||||
icon: null,
|
||||
pins: 4,
|
||||
delegate: false,
|
||||
development: false,
|
||||
variadic: false,
|
||||
additionalTest: async (node, pins) => {
|
||||
for (const pin of pins) {
|
||||
expect(await pin.evaluate(pin => pin.template.renderIcon().strings.join("")))
|
||||
.toStrictEqual(SVGIcon.genericPin.strings.join(""))
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user