Files
ueblueprint/cypress/e2e/hid/getMouseWheelAxis.cy.js
2023-01-28 23:33:08 +01:00

63 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("Get Mouse Wheel Axis", () => {
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_GetInputAxisKeyValue Name="K2Node_GetInputAxisKeyValue_0"
InputAxisKey=MouseWheelAxis
bIsPureFunc=True
bIsConstFunc=True
FunctionReference=(MemberName="GetInputAxisKeyValue",bSelfContext=True)
NodePosX=-368
NodePosY=48
NodeGuid=D736BB862CE14C67807E646AD89E463E
CustomProperties Pin (PinId=5D9420322C22469CA6CC9F9F2B9C0CBB,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.Actor"',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=True,bNotConnectable=True,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=960A0E4D5D624270A0734C54E3FEF0F5,PinName="InputAxisKey",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/InputCore.Key"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="MouseWheelAxis",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=F62C40D72EE04CD294EFBE7582CA5FB0,PinName="ReturnValue",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 green", () => expect(node.entity.nodeColor()).to.be.deep.equal(Configuration.nodeColors.green))
it("has no delegate", () => expect(node.querySelector('.ueb-node-top ueb-pin[data-type="delegate"]')).to.be.null)
it("is called Get Mouse Wheel Axis", () => expect(node.getNodeDisplayName()).to.be.equal("Get Mouse Wheel Axis"))
it("has a mouse icon", () => expect(node.entity.nodeIcon()).to.be.deep.equal(SVGIcon.mouse))
it("has 1 pin", () => expect(node.querySelectorAll("ueb-pin")).to.be.lengthOf(1))
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([
"InputAxisKey",
"bIsPureFunc",
"bIsConstFunc",
"FunctionReference",
"NodePosX",
"NodePosY",
"NodeGuid",
"CustomProperties",
"CustomProperties",
"CustomProperties",
]))
})
})
})