mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-22 22:27:30 +08:00
Node tests are now more customizeable
This commit is contained in:
@@ -7,6 +7,7 @@ import SVGIcon from "../../js/SVGIcon"
|
|||||||
const tests = [
|
const tests = [
|
||||||
{
|
{
|
||||||
name: "==",
|
name: "==",
|
||||||
|
title: null,
|
||||||
value: String.raw`
|
value: String.raw`
|
||||||
Begin Object Class=/Script/BlueprintGraph.K2Node_PromotableOperator Name="K2Node_PromotableOperator_0"
|
Begin Object Class=/Script/BlueprintGraph.K2Node_PromotableOperator Name="K2Node_PromotableOperator_0"
|
||||||
bIsPureFunc=True
|
bIsPureFunc=True
|
||||||
@@ -19,9 +20,7 @@ const tests = [
|
|||||||
CustomProperties Pin (PinId=F34B818F900A4222BCC1DE111C2C7816,PinName="ReturnValue",PinToolTip="Return Value\nBoolean\n\nReturns whether brushes A and B are identical.",Direction="EGPD_Output",PinType.PinCategory="bool",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=F34B818F900A4222BCC1DE111C2C7816,PinName="ReturnValue",PinToolTip="Return Value\nBoolean\n\nReturns whether brushes A and B are identical.",Direction="EGPD_Output",PinType.PinCategory="bool",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,)
|
||||||
End Object
|
End Object
|
||||||
`,
|
`,
|
||||||
color: Configuration.nodeColors.gray,
|
pins: 3,
|
||||||
icon: SVGIcon.questionMark,
|
|
||||||
pins: 4,
|
|
||||||
delegate: false,
|
delegate: false,
|
||||||
development: false,
|
development: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,13 +13,18 @@ export function generateNodeTest(nodeTest, getBlueprint) {
|
|||||||
context(nodeTest.name, () => {
|
context(nodeTest.name, () => {
|
||||||
/** @type {NodeElement} */
|
/** @type {NodeElement} */
|
||||||
let node
|
let node
|
||||||
|
if (nodeTest.title === undefined) {
|
||||||
|
nodeTest.title = nodeTest.name
|
||||||
|
}
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
getBlueprint().removeGraphElement(...getBlueprint().getNodes())
|
getBlueprint().removeGraphElement(...getBlueprint().getNodes())
|
||||||
Utility.paste(getBlueprint(), nodeTest.value)
|
Utility.paste(getBlueprint(), nodeTest.value)
|
||||||
node = getBlueprint().querySelector("ueb-node")
|
node = getBlueprint().querySelector("ueb-node")
|
||||||
})
|
})
|
||||||
it("Has correct color", () => expect(node.entity.nodeColor()).to.be.deep.equal(nodeTest.color))
|
if (nodeTest.color) {
|
||||||
|
it("Has correct color", () => expect(node.entity.nodeColor()).to.be.deep.equal(nodeTest.color))
|
||||||
|
}
|
||||||
it("Has correct delegate", () => {
|
it("Has correct delegate", () => {
|
||||||
const delegate = node.querySelector('.ueb-node-top ueb-pin[data-type="delegate"]')
|
const delegate = node.querySelector('.ueb-node-top ueb-pin[data-type="delegate"]')
|
||||||
if (nodeTest.delegate) {
|
if (nodeTest.delegate) {
|
||||||
@@ -28,9 +33,13 @@ export function generateNodeTest(nodeTest, getBlueprint) {
|
|||||||
expect(delegate).to.be.null
|
expect(delegate).to.be.null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
it("It's called " + nodeTest.name, () => expect(node.getNodeDisplayName()).to.be.equal(nodeTest.name))
|
if (nodeTest.title) {
|
||||||
|
it("Has title " + nodeTest.title, () => expect(node.getNodeDisplayName()).to.be.equal(nodeTest.title))
|
||||||
|
}
|
||||||
it("Has expected subtitle " + nodeTest.subtitle, () => expect(node.querySelector(".ueb-node-subtitle-text")?.innerText).to.be.equal(nodeTest.subtitle))
|
it("Has expected subtitle " + nodeTest.subtitle, () => expect(node.querySelector(".ueb-node-subtitle-text")?.innerText).to.be.equal(nodeTest.subtitle))
|
||||||
it("Has the correct icon", () => expect(node.entity.nodeIcon()).to.be.deep.equal(nodeTest.icon))
|
if (nodeTest.icon) {
|
||||||
|
it("Has the correct icon", () => expect(node.entity.nodeIcon()).to.be.deep.equal(nodeTest.icon))
|
||||||
|
}
|
||||||
it(`Has ${nodeTest.pins} pins`, () => expect(node.querySelectorAll("ueb-pin")).to.be.lengthOf(nodeTest.pins))
|
it(`Has ${nodeTest.pins} pins`, () => expect(node.querySelectorAll("ueb-pin")).to.be.lengthOf(nodeTest.pins))
|
||||||
it("Expected development", () => expect(node.entity.isDevelopmentOnly()).equals(nodeTest.development))
|
it("Expected development", () => expect(node.entity.isDevelopmentOnly()).equals(nodeTest.development))
|
||||||
it("Maintains the order of attributes", () => {
|
it("Maintains the order of attributes", () => {
|
||||||
|
|||||||
4
dist/ueblueprint.js
vendored
4
dist/ueblueprint.js
vendored
@@ -2124,6 +2124,9 @@ class PinEntity extends IEntity {
|
|||||||
|
|
||||||
getDisplayName() {
|
getDisplayName() {
|
||||||
let matchResult = null;
|
let matchResult = null;
|
||||||
|
if (this.PinFriendlyName) {
|
||||||
|
return Utility.formatStringName(this.PinFriendlyName.toString())
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
this.PinToolTip
|
this.PinToolTip
|
||||||
// Match up until the first \n excluded or last character
|
// Match up until the first \n excluded or last character
|
||||||
@@ -7002,7 +7005,6 @@ class MinimalPinTemplate extends PinTemplate {
|
|||||||
/**
|
/**
|
||||||
* @typedef {import("../../element/PinElement").PinElementConstructor} PinElementConstructor
|
* @typedef {import("../../element/PinElement").PinElementConstructor} PinElementConstructor
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
* @typedef {import("lit").PropertyValues} PropertyValues
|
||||||
* @typedef {import ("../../element/NodeElement.js").default} NodeElement
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class EventNodeTemplate extends NodeTemplate {
|
class EventNodeTemplate extends NodeTemplate {
|
||||||
|
|||||||
6
dist/ueblueprint.min.js
vendored
6
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -211,6 +211,9 @@ export default class PinEntity extends IEntity {
|
|||||||
|
|
||||||
getDisplayName() {
|
getDisplayName() {
|
||||||
let matchResult = null
|
let matchResult = null
|
||||||
|
if (this.PinFriendlyName) {
|
||||||
|
return Utility.formatStringName(this.PinFriendlyName.toString())
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
this.PinToolTip
|
this.PinToolTip
|
||||||
// Match up until the first \n excluded or last character
|
// Match up until the first \n excluded or last character
|
||||||
|
|||||||
Reference in New Issue
Block a user