mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
169 lines
8.1 KiB
JavaScript
169 lines
8.1 KiB
JavaScript
/// <reference types="cypress" />
|
|
|
|
import { generateNodeTest } from "../fixtures/testUtilities.js"
|
|
import Configuration from "../../js/Configuration.js"
|
|
import SVGIcon from "../../js/SVGIcon.js"
|
|
|
|
const tests = [
|
|
/*{
|
|
name: "ROS Change Element",
|
|
value: String.raw`
|
|
Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_131095"
|
|
NodePosX=-5024
|
|
NodePosY=-1888
|
|
NodeGuid=CC44F0434996CC21484572A242E1F72D
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_3991113"
|
|
End Object
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_3991114"
|
|
End Object
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_3991115"
|
|
End Object
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_3991116"
|
|
End Object
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_3991117"
|
|
End Object
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_3991118"
|
|
End Object
|
|
FunctionReference=(MemberParentClass=Class'/Script/ShooterGame.ShooterGameMode',MemberName="GetFloatOptionIni")
|
|
Pins(0)=EdGraphPin'EdGraphPin_3991113'
|
|
Pins(1)=EdGraphPin'EdGraphPin_3991114'
|
|
Pins(2)=EdGraphPin'EdGraphPin_3991115'
|
|
Pins(3)=EdGraphPin'EdGraphPin_3991116'
|
|
Pins(4)=EdGraphPin'EdGraphPin_3991117'
|
|
Pins(5)=EdGraphPin'EdGraphPin_3991118'
|
|
ErrorType=1
|
|
ErrorMsg="Error This blueprint (self) is not a ShooterGameMode, therefore \' Target \' must have a connection\nError This blueprint (self) is not a ShooterGameMode, therefore \' Target \' must have a connection"
|
|
Begin Object Name="EdGraphPin_3991113"
|
|
PinName="execute"
|
|
PinType=(PinCategory="exec")
|
|
LinkedTo(0)=EdGraphPin'"K2Node_CallFunction_113214.EdGraphPin_3991579"'
|
|
End Object
|
|
Begin Object Name="EdGraphPin_3991114"
|
|
PinName="then"
|
|
Direction=EGPD_Output
|
|
PinType=(PinCategory="exec")
|
|
LinkedTo(0)=EdGraphPin'"K2Node_IfThenElse_7680.EdGraphPin_3991155"'
|
|
End Object
|
|
Begin Object Name="EdGraphPin_3991115"
|
|
PinName="self"
|
|
PinFriendlyName="Target"
|
|
PinToolTip="Target\nShooter Game Mode Reference"
|
|
PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/ShooterGame.ShooterGameMode')
|
|
LinkedTo(0)=EdGraphPin'"K2Node_DynamicCast_2126.EdGraphPin_3990988"'
|
|
End Object
|
|
Begin Object Name="EdGraphPin_3991116"
|
|
PinName="Section"
|
|
PinToolTip="Section\nString"
|
|
PinType=(PinCategory="string")
|
|
DefaultValue="CrazysDinosStats"
|
|
End Object
|
|
Begin Object Name="EdGraphPin_3991117"
|
|
PinName="OptionName"
|
|
PinToolTip="Option Name\nString"
|
|
PinType=(PinCategory="string")
|
|
DefaultValue="DinoStamina"
|
|
End Object
|
|
Begin Object Name="EdGraphPin_3991118"
|
|
PinName="ReturnValue"
|
|
PinToolTip="Return Value\nFloat"
|
|
Direction=EGPD_Output
|
|
PinType=(PinCategory="float")
|
|
DefaultValue="0.0"
|
|
AutogeneratedDefaultValue="0.0"
|
|
LinkedTo(0)=EdGraphPin'"K2Node_CallFunction_131096.EdGraphPin_3991132"'
|
|
LinkedTo(1)=EdGraphPin'"K2Node_CallFunction_131097.EdGraphPin_3991144"'
|
|
LinkedTo(2)=EdGraphPin'"K2Node_VariableSet_21447.EdGraphPin_3992243"'
|
|
End Object
|
|
End Object
|
|
`,
|
|
pins: 2,
|
|
delegate: false,
|
|
development: false,
|
|
},*/
|
|
{
|
|
name: "Flip Flop",
|
|
value: String.raw`
|
|
Begin Object Class=K2Node_MacroInstance Name="K2Node_MacroInstance_1262"
|
|
NodePosX=3984
|
|
NodePosY=-960
|
|
NodeGuid=968059974A02AF6B67D2879EC909179A
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_59688"
|
|
End Object
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_59689"
|
|
End Object
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_59690"
|
|
End Object
|
|
Begin Object Class=EdGraphPin Name="EdGraphPin_59691"
|
|
End Object
|
|
MacroGraphReference=(MacroGraph=EdGraph'/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:FlipFlop',GraphBlueprint=Blueprint'/Engine/EditorBlueprintResources/StandardMacros.StandardMacros',GraphGuid=BFFFAAE4434E166F549665AD1AA89B60)
|
|
Pins(0)=EdGraphPin'EdGraphPin_59688'
|
|
Pins(1)=EdGraphPin'EdGraphPin_59689'
|
|
Pins(2)=EdGraphPin'EdGraphPin_59690'
|
|
Pins(3)=EdGraphPin'EdGraphPin_59691'
|
|
Begin Object Name="EdGraphPin_59688"
|
|
PinType=(PinCategory="exec")
|
|
LinkedTo(0)=EdGraphPin'K2Node_InputKey_1185.EdGraphPin_42090'
|
|
LinkedTo(1)=EdGraphPin'K2Node_InputKey_14487.EdGraphPin_45417'
|
|
End Object
|
|
Begin Object Name="EdGraphPin_59689"
|
|
PinName="A"
|
|
Direction=EGPD_Output
|
|
PinType=(PinCategory="exec")
|
|
LinkedTo(0)=EdGraphPin'K2Node_CallFunction_7370.EdGraphPin_43320'
|
|
End Object
|
|
Begin Object Name="EdGraphPin_59690"
|
|
PinName="B"
|
|
Direction=EGPD_Output
|
|
PinType=(PinCategory="exec")
|
|
LinkedTo(0)=EdGraphPin'K2Node_CallFunction_44249.EdGraphPin_43272'
|
|
End Object
|
|
Begin Object Name="EdGraphPin_59691"
|
|
PinName="IsA"
|
|
Direction=EGPD_Output
|
|
PinType=(PinCategory="bool")
|
|
End Object
|
|
End Object
|
|
`,
|
|
color: Configuration.nodeColors.gray,
|
|
icon: SVGIcon.flipflop,
|
|
pins: 4,
|
|
pinName: ["A", "B", "IsA"],
|
|
delegate: false,
|
|
development: false,
|
|
additionalTest:
|
|
/** @param {import("../../js/element/NodeElement.js").default} node */
|
|
node => {
|
|
const entity = node.entity
|
|
expect(entity.Class.type).to.be.equal("/Script/BlueprintGraph.K2Node_MacroInstance")
|
|
expect(entity.MacroGraphReference.MacroGraph.type).to.be.equal("/Script/Engine.EdGraph")
|
|
expect(entity.MacroGraphReference.MacroGraph.path).to.be.equal("/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:FlipFlop")
|
|
expect(entity.MacroGraphReference.GraphBlueprint.type).to.be.equal("/Script/Engine.Blueprint")
|
|
expect(entity.MacroGraphReference.GraphBlueprint.path).to.be.equal("/Engine/EditorBlueprintResources/StandardMacros.StandardMacros")
|
|
const pinObjects = Object.keys(entity)
|
|
.filter(k => k.startsWith(Configuration.subObjectAttributeNamePrefix))
|
|
.map(k => /** @type {import("../../js/entity/ObjectEntity.js").default} */(entity[k]))
|
|
.filter(v => v.getType())
|
|
expect(pinObjects).to.be.of.length(4)
|
|
pinObjects.forEach(v => expect(v.getType()).to.be.equal(Configuration.nodeType.edGraphPinDeprecated))
|
|
expect(entity.getPinEntities()).to.be.of.length(4)
|
|
}
|
|
},
|
|
]
|
|
|
|
/** @type {Blueprint} */
|
|
let blueprint
|
|
|
|
before(() => {
|
|
cy.visit(`http://127.0.0.1:${Cypress.env("UEBLUEPRINT_TEST_SERVER_PORT")}/empty.html`, {
|
|
onLoad: () => {
|
|
cy.get("ueb-blueprint")
|
|
.then(b => blueprint = b[0])
|
|
.click(100, 300)
|
|
}
|
|
})
|
|
})
|
|
|
|
tests.forEach(
|
|
testObject => generateNodeTest(testObject, () => blueprint)
|
|
)
|