mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-24 16:04:44 +08:00
61 lines
4.8 KiB
JavaScript
61 lines
4.8 KiB
JavaScript
/// <reference types="cypress" />
|
|
|
|
import Blueprint from "../../../js/Blueprint"
|
|
import Configuration from "../../../js/Configuration"
|
|
import getFirstWordOrder from "../../fixtures/getFirstWordOrder"
|
|
import NodeElement from "../../../js/element/NodeElement"
|
|
import SVGIcon from "../../../js/SVGIcon"
|
|
import Utility from "../../../js/Utility"
|
|
|
|
describe("Acceleration", () => {
|
|
|
|
context("Tests", () => {
|
|
/** @type {NodeElement} */
|
|
let node
|
|
/** @type {Blueprint} */
|
|
let blueprint
|
|
|
|
before(() => {
|
|
cy.visit(`http://127.0.0.1:${Cypress.env("UEBLUEPRINT_TEST_SERVER_PORT")}/empty.html`)
|
|
cy.get("ueb-blueprint")
|
|
.then(b => blueprint = b[0])
|
|
.click(100, 300)
|
|
.then(() => Utility.paste(blueprint, String.raw`
|
|
Begin Object Class=/Script/BlueprintGraph.K2Node_InputVectorAxisEvent Name="K2Node_InputVectorAxisEvent_0"
|
|
AxisKey=Acceleration
|
|
EventReference=(MemberParent=/Script/CoreUObject.Package'"/Script/Engine"')
|
|
CustomFunctionName="InpAxisKeyEvt_Acceleration_K2Node_InputVectorAxisEvent_0"
|
|
NodePosX=-336
|
|
NodePosY=-16
|
|
NodeGuid=173829878718477795AB5367F46E1C7D
|
|
CustomProperties Pin (PinId=A12FF63CF5344B58ADF03B3680AB1A64,PinName="OutputDelegate",Direction="EGPD_Output",PinType.PinCategory="delegate",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(MemberParent=/Script/Engine.BlueprintGeneratedClass'"/Temp/Untitled_1.Untitled_C"',MemberName="InpAxisKeyEvt_Acceleration_K2Node_InputVectorAxisEvent_0"),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=5DA7BAAABDD1489983119B2B0F7C2D30,PinName="then",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=2F4036231C574CA280628C783B83F22F,PinName="AxisValue",PinToolTip="Axis Value\nVector",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
|
|
`))
|
|
.then(() => node = blueprint.querySelector("ueb-node"))
|
|
})
|
|
it("is red", () => expect(node.entity.nodeColor()).to.be.deep.equal(Configuration.nodeColors.red))
|
|
it("has a delegate", () => expect(node.querySelector('.ueb-node-top ueb-pin[data-type="delegate"]')).to.not.be.null)
|
|
it("is called Acceleration", () => expect(node.getNodeDisplayName()).to.be.equal("Acceleration"))
|
|
it("has a keyboard icon", () => expect(node.entity.nodeIcon()).to.be.deep.equal(SVGIcon.keyboard))
|
|
it("has 3 pins", () => expect(node.querySelectorAll("ueb-pin")).to.be.lengthOf(3))
|
|
it("is not development only", () => expect(node.entity.isDevelopmentOnly()).to.be.false)
|
|
it("maintains the order of attributes", () => {
|
|
blueprint.selectAll()
|
|
const value = blueprint.template.getCopyInputObject().getSerializedText()
|
|
expect(value).to.match(getFirstWordOrder([
|
|
"AxisKey",
|
|
"EventReference",
|
|
"CustomFunctionName",
|
|
"NodePosX",
|
|
"NodePosY",
|
|
"NodeGuid",
|
|
"CustomProperties",
|
|
"CustomProperties",
|
|
"CustomProperties",
|
|
]))
|
|
})
|
|
})
|
|
})
|