Files
ueblueprint/cypress/e2e/hid/mouseX.cy.js
2023-01-26 22:02:43 +01:00

61 lines
4.7 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("Mouse X", () => {
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_InputAxisKeyEvent Name="K2Node_InputAxisKeyEvent_2"
AxisKey=MouseX
EventReference=(MemberParent=/Script/CoreUObject.Package'"/Script/Engine"')
CustomFunctionName="InpAxisKeyEvt_MouseX_K2Node_InputAxisKeyEvent_2"
NodePosX=16
NodePosY=384
NodeGuid=F7AA7D36A681494A9F28239D0FA8FB2D
CustomProperties Pin (PinId=8525745F49DB46C9BBDA7549AB9CD8B5,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_MouseX_K2Node_InputAxisKeyEvent_2"),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=6273D30435714B84BD2139DB4FAFE72F,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=E43D43763CD64E2CB1B030ECCEED6115,PinName="AxisValue",PinToolTip="Axis Value\nFloat (single-precision)",Direction="EGPD_Output",PinType.PinCategory="real",PinType.PinSubCategory="float",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="0.0",AutogeneratedDefaultValue="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(Configuration.nodeColor(node)).to.be.equal(Configuration.nodeColors.red))
it("has a delegate", () => expect(node.querySelector('.ueb-node-top ueb-pin[data-type="delegate"]')).to.be.not.null)
it("is called Mouse X", () => expect(node.getNodeDisplayName()).to.be.equal("Mouse X"))
it("has a mouse icon", () => expect(Configuration.nodeIcon(node)).to.be.equal(SVGIcon.mouse))
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",
]))
})
})
})