Skip to content

Commit 5a2387c

Browse files
committed
Minor modification.
1 parent 401e3ca commit 5a2387c

3 files changed

Lines changed: 109 additions & 94 deletions

File tree

Sources/NodeEngineTest/NodeEditorVisualTest.cpp

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,6 @@ using namespace BI;
1313
namespace NodeEditorVisualTest
1414
{
1515

16-
const BasicSkinParams& GetSkinParamsWithMarkers ()
17-
{
18-
static const BasicSkinParams markersSkinParams (
19-
/*backgroundColor*/ NUIE::Color (250, 250, 250),
20-
/*connectionLinePen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
21-
/*connectionMarker*/ NUIE::SkinParams::ConnectionMarker::Circle,
22-
/*connectionMarkerSize*/ NUIE::Size (8.0, 8.0),
23-
/*nodePadding*/ 5.0,
24-
/*nodeBorderPen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
25-
/*nodeHeaderTextFont*/ NUIE::Font (L"Arial", 16.0),
26-
/*nodeHeaderTextColor*/ NUIE::Color (250, 250, 250),
27-
/*nodeHeaderErrorTextColor*/ NUIE::Color (250, 250, 250),
28-
/*nodeHeaderBackgroundColor*/ NUIE::Color (41, 127, 255),
29-
/*nodeHeaderErrorBackgroundColor*/ NUIE::Color (199, 80, 80),
30-
/*nodeContentTextFont*/ NUIE::Font (L"Arial", 14.0),
31-
/*nodeContentTextColor*/ NUIE::Color (0, 0, 0),
32-
/*nodeContentBackgroundColor*/ NUIE::Color (236, 236, 236),
33-
/*slotTextColor*/ NUIE::Color (0, 0, 0),
34-
/*slotTextBackgroundColor*/ NUIE::Color (246, 246, 246),
35-
/*slotMarker*/ NUIE::SkinParams::SlotMarker::Circle,
36-
/*hiddenSlotMarker*/ NUIE::SkinParams::HiddenSlotMarker::Arrow,
37-
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
38-
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (41, 127, 255), 0.25),
39-
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),
40-
/*selectionRectPen*/ NUIE::Pen (NUIE::Color (41, 127, 255), 1.0),
41-
/*nodeSelectionRectPen*/ NUIE::Pen (NUIE::Color (41, 127, 255), 3.0),
42-
/*buttonBorderPen*/ NUIE::Pen (NUIE::Color (146, 152, 155), 1.0),
43-
/*buttonBackgroundColor*/ NUIE::Color (217, 217, 217),
44-
/*textPanelTextColor*/ NUIE::Color (0, 0, 0),
45-
/*textPanelBackgroundColor*/ NUIE::Color (236, 236, 236),
46-
/*groupNameFont*/ NUIE::Font (L"Arial", 16.0),
47-
/*groupNameColor*/ NUIE::Color (0, 0, 0),
48-
/*groupBackgroundColors*/ NUIE::NamedColorSet ({
49-
{ NE::LocalizeString (L"Blue"), NUIE::Color (160, 200, 240) },
50-
{ NE::LocalizeString (L"Green"), NUIE::Color (160, 239, 160) },
51-
{ NE::LocalizeString (L"Red"), NUIE::Color (239, 189, 160) }
52-
}),
53-
/*groupPadding*/ 10.0
54-
);
55-
return markersSkinParams;
56-
}
57-
5816
TEST (SelectionTest)
5917
{
6018
SimpleNodeEditorTestEnv env (GetDefaultSkinParams ());
@@ -529,35 +487,6 @@ TEST (CenterToWindowTestWithScale)
529487
ASSERT (env.CheckReference (L"CenterToWindowWithScale_Align.svg"));
530488
}
531489

532-
TEST (SlotMarkersTest)
533-
{
534-
SimpleNodeEditorTestEnvWithConnections env (GetSkinParamsWithMarkers ());
535-
ASSERT (env.CheckReference (L"Markers_Initial.svg"));
536-
537-
{ // start connecting double output slot without target
538-
Point doubleOutputSlotPosition = env.doubleUpDownNode->GetOutputSlotRect (env.uiEnvironment, SlotId ("out")).GetCenter ();
539-
Point targetPosition = doubleOutputSlotPosition + Point (200.0, -100.0);
540-
env.DragDrop (doubleOutputSlotPosition, targetPosition, [&] () {
541-
ASSERT (env.CheckReference (L"Markers_DuringConnectionForward.svg"));
542-
});
543-
}
544-
545-
{ // start connecting viewer input slot without target
546-
Point viewerInputSlotPosition = env.viewerUINode1->GetInputSlotRect (env.uiEnvironment, SlotId ("in")).GetCenter ();
547-
Point targetPosition = viewerInputSlotPosition + Point (-200.0, 100.0);
548-
env.DragDrop (viewerInputSlotPosition, targetPosition, [&] () {
549-
ASSERT (env.CheckReference (L"Markers_DuringConnectionBackward.svg"));
550-
});
551-
}
552-
}
553-
554-
TEST (SlotMarkersFitToWindowTest)
555-
{
556-
SimpleNodeEditorTestEnvWithConnections env (GetSkinParamsWithMarkers ());
557-
env.nodeEditor.FitToWindow ();
558-
ASSERT (env.CheckReference (L"Markers_FitToWindow.svg"));
559-
}
560-
561490
TEST (GroupSelectedNodesTest)
562491
{
563492
SimpleNodeEditorTestEnvWithConnections env (GetDefaultSkinParams ());
@@ -637,23 +566,4 @@ TEST (AlignNodesTest)
637566
}
638567
}
639568

640-
TEST (HideConnectionsTest)
641-
{
642-
FeatureEnableGuard featureGuard (Feature::ConnectionDisplay, true);
643-
SimpleNodeEditorTestEnvWithConnections env (GetSkinParamsWithMarkers ());
644-
645-
ASSERT (env.CheckReference (L"HideConnectionsTest_Initial.svg"));
646-
647-
{ // hide input connections for viewer 2
648-
env.SetNextCommandName (L"Hidden");
649-
env.RightClick (env.viewer2InputSlotRect.GetCenter ());
650-
ASSERT (env.CheckReference (L"HideConnectionsTest_ConnectionHidden.svg"));
651-
}
652-
653-
{ // select viewer 2
654-
env.Click (env.viewer2HeaderPoint);
655-
ASSERT (env.CheckReference (L"HideConnectionsTest_Viewer2Selected.svg"));
656-
}
657-
}
658-
659569
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#include "SimpleTest.hpp"
2+
#include "NUIE_NodeEditor.hpp"
3+
#include "NUIE_NodeCommonMenuCommands.hpp"
4+
#include "NUIE_FeatureSet.hpp"
5+
#include "BI_InputUINodes.hpp"
6+
#include "BI_ViewerUINodes.hpp"
7+
#include "VisualTestFramework.hpp"
8+
9+
using namespace NE;
10+
using namespace NUIE;
11+
using namespace BI;
12+
13+
namespace NodeEditorVisualTestSlotMarkers
14+
{
15+
16+
const BasicSkinParams& GetSkinParamsWithMarkers ()
17+
{
18+
static const BasicSkinParams markersSkinParams (
19+
/*backgroundColor*/ NUIE::Color (250, 250, 250),
20+
/*connectionLinePen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
21+
/*connectionMarker*/ NUIE::SkinParams::ConnectionMarker::Circle,
22+
/*connectionMarkerSize*/ NUIE::Size (8.0, 8.0),
23+
/*nodePadding*/ 5.0,
24+
/*nodeBorderPen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
25+
/*nodeHeaderTextFont*/ NUIE::Font (L"Arial", 16.0),
26+
/*nodeHeaderTextColor*/ NUIE::Color (250, 250, 250),
27+
/*nodeHeaderErrorTextColor*/ NUIE::Color (250, 250, 250),
28+
/*nodeHeaderBackgroundColor*/ NUIE::Color (41, 127, 255),
29+
/*nodeHeaderErrorBackgroundColor*/ NUIE::Color (199, 80, 80),
30+
/*nodeContentTextFont*/ NUIE::Font (L"Arial", 14.0),
31+
/*nodeContentTextColor*/ NUIE::Color (0, 0, 0),
32+
/*nodeContentBackgroundColor*/ NUIE::Color (236, 236, 236),
33+
/*slotTextColor*/ NUIE::Color (0, 0, 0),
34+
/*slotTextBackgroundColor*/ NUIE::Color (246, 246, 246),
35+
/*slotMarker*/ NUIE::SkinParams::SlotMarker::Circle,
36+
/*hiddenSlotMarker*/ NUIE::SkinParams::HiddenSlotMarker::Arrow,
37+
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
38+
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (41, 127, 255), 0.25),
39+
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),
40+
/*selectionRectPen*/ NUIE::Pen (NUIE::Color (41, 127, 255), 1.0),
41+
/*nodeSelectionRectPen*/ NUIE::Pen (NUIE::Color (41, 127, 255), 3.0),
42+
/*buttonBorderPen*/ NUIE::Pen (NUIE::Color (146, 152, 155), 1.0),
43+
/*buttonBackgroundColor*/ NUIE::Color (217, 217, 217),
44+
/*textPanelTextColor*/ NUIE::Color (0, 0, 0),
45+
/*textPanelBackgroundColor*/ NUIE::Color (236, 236, 236),
46+
/*groupNameFont*/ NUIE::Font (L"Arial", 16.0),
47+
/*groupNameColor*/ NUIE::Color (0, 0, 0),
48+
/*groupBackgroundColors*/ NUIE::NamedColorSet ({
49+
{ NE::LocalizeString (L"Blue"), NUIE::Color (160, 200, 240) },
50+
{ NE::LocalizeString (L"Green"), NUIE::Color (160, 239, 160) },
51+
{ NE::LocalizeString (L"Red"), NUIE::Color (239, 189, 160) }
52+
}),
53+
/*groupPadding*/ 10.0
54+
);
55+
return markersSkinParams;
56+
}
57+
58+
TEST (SlotMarkersTest)
59+
{
60+
SimpleNodeEditorTestEnvWithConnections env (GetSkinParamsWithMarkers ());
61+
ASSERT (env.CheckReference (L"Markers_Initial.svg"));
62+
63+
{ // start connecting double output slot without target
64+
Point doubleOutputSlotPosition = env.doubleUpDownNode->GetOutputSlotRect (env.uiEnvironment, SlotId ("out")).GetCenter ();
65+
Point targetPosition = doubleOutputSlotPosition + Point (200.0, -100.0);
66+
env.DragDrop (doubleOutputSlotPosition, targetPosition, [&] () {
67+
ASSERT (env.CheckReference (L"Markers_DuringConnectionForward.svg"));
68+
});
69+
}
70+
71+
{ // start connecting viewer input slot without target
72+
Point viewerInputSlotPosition = env.viewerUINode1->GetInputSlotRect (env.uiEnvironment, SlotId ("in")).GetCenter ();
73+
Point targetPosition = viewerInputSlotPosition + Point (-200.0, 100.0);
74+
env.DragDrop (viewerInputSlotPosition, targetPosition, [&] () {
75+
ASSERT (env.CheckReference (L"Markers_DuringConnectionBackward.svg"));
76+
});
77+
}
78+
}
79+
80+
TEST (SlotMarkersFitToWindowTest)
81+
{
82+
SimpleNodeEditorTestEnvWithConnections env (GetSkinParamsWithMarkers ());
83+
env.nodeEditor.FitToWindow ();
84+
ASSERT (env.CheckReference (L"Markers_FitToWindow.svg"));
85+
}
86+
87+
TEST (HideConnectionsTest)
88+
{
89+
FeatureEnableGuard featureGuard (Feature::ConnectionDisplay, true);
90+
SimpleNodeEditorTestEnvWithConnections env (GetSkinParamsWithMarkers ());
91+
92+
ASSERT (env.CheckReference (L"HideConnectionsTest_Initial.svg"));
93+
94+
{ // hide input connections for viewer 2
95+
env.SetNextCommandName (L"Hidden");
96+
env.RightClick (env.viewer2InputSlotRect.GetCenter ());
97+
ASSERT (env.CheckReference (L"HideConnectionsTest_ConnectionHidden.svg"));
98+
}
99+
100+
{ // select viewer 2
101+
env.Click (env.viewer2HeaderPoint);
102+
ASSERT (env.CheckReference (L"HideConnectionsTest_Viewer2Selected.svg"));
103+
}
104+
}
105+
106+
}

Sources/NodeUIEngine/NUIE_NodeUIManagerDrawer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,10 @@ Rect ExtendNodeRect (NodeUIDrawingEnvironment& drawingEnv, const Rect& originalR
331331
const SkinParams& skinParams = drawingEnv.GetSkinParams ();
332332
const Size& slotMarkerSize = skinParams.GetSlotMarkerSize ();
333333
double extendSize = 0.0;
334-
if (skinParams.GetSlotMarker () != SkinParams::SlotMarker::None) {
335-
extendSize += slotMarkerSize.GetWidth () / 2.0;
336-
}
337334
if (skinParams.GetHiddenSlotMarker () != SkinParams::HiddenSlotMarker::None) {
338-
extendSize += slotMarkerSize.GetWidth ();
335+
extendSize = slotMarkerSize.GetWidth () + slotMarkerSize.GetWidth () / 2.0;
336+
} else if (skinParams.GetSlotMarker () != SkinParams::SlotMarker::None) {
337+
extendSize = slotMarkerSize.GetWidth () / 2.0;
339338
}
340339
return originalRect.ExpandHorizontally (extendSize, extendSize);
341340
}

0 commit comments

Comments
 (0)