@@ -52,7 +52,7 @@ public void TestPerfectCurveTooManyPoints()
52
52
{
53
53
createVisualiser ( true ) ;
54
54
55
- addControlPointStep ( new Vector2 ( 200 ) , PathType . Bezier ) ;
55
+ addControlPointStep ( new Vector2 ( 200 ) , PathType . BEZIER ) ;
56
56
addControlPointStep ( new Vector2 ( 300 ) ) ;
57
57
addControlPointStep ( new Vector2 ( 500 , 300 ) ) ;
58
58
addControlPointStep ( new Vector2 ( 700 , 200 ) ) ;
@@ -63,17 +63,17 @@ public void TestPerfectCurveTooManyPoints()
63
63
AddStep ( "select control point" , ( ) => visualiser . Pieces [ 1 ] . IsSelected . Value = true ) ;
64
64
addContextMenuItemStep ( "Perfect curve" ) ;
65
65
66
- assertControlPointPathType ( 0 , PathType . Bezier ) ;
67
- assertControlPointPathType ( 1 , PathType . PerfectCurve ) ;
68
- assertControlPointPathType ( 3 , PathType . Bezier ) ;
66
+ assertControlPointPathType ( 0 , PathType . BEZIER ) ;
67
+ assertControlPointPathType ( 1 , PathType . PERFECT_CURVE ) ;
68
+ assertControlPointPathType ( 3 , PathType . BEZIER ) ;
69
69
}
70
70
71
71
[ Test ]
72
72
public void TestPerfectCurveLastThreePoints ( )
73
73
{
74
74
createVisualiser ( true ) ;
75
75
76
- addControlPointStep ( new Vector2 ( 200 ) , PathType . Bezier ) ;
76
+ addControlPointStep ( new Vector2 ( 200 ) , PathType . BEZIER ) ;
77
77
addControlPointStep ( new Vector2 ( 300 ) ) ;
78
78
addControlPointStep ( new Vector2 ( 500 , 300 ) ) ;
79
79
addControlPointStep ( new Vector2 ( 700 , 200 ) ) ;
@@ -83,8 +83,8 @@ public void TestPerfectCurveLastThreePoints()
83
83
AddStep ( "select control point" , ( ) => visualiser . Pieces [ 2 ] . IsSelected . Value = true ) ;
84
84
addContextMenuItemStep ( "Perfect curve" ) ;
85
85
86
- assertControlPointPathType ( 0 , PathType . Bezier ) ;
87
- assertControlPointPathType ( 2 , PathType . PerfectCurve ) ;
86
+ assertControlPointPathType ( 0 , PathType . BEZIER ) ;
87
+ assertControlPointPathType ( 2 , PathType . PERFECT_CURVE ) ;
88
88
assertControlPointPathType ( 4 , null ) ;
89
89
}
90
90
@@ -93,7 +93,7 @@ public void TestPerfectCurveLastTwoPoints()
93
93
{
94
94
createVisualiser ( true ) ;
95
95
96
- addControlPointStep ( new Vector2 ( 200 ) , PathType . Bezier ) ;
96
+ addControlPointStep ( new Vector2 ( 200 ) , PathType . BEZIER ) ;
97
97
addControlPointStep ( new Vector2 ( 300 ) ) ;
98
98
addControlPointStep ( new Vector2 ( 500 , 300 ) ) ;
99
99
addControlPointStep ( new Vector2 ( 700 , 200 ) ) ;
@@ -103,7 +103,7 @@ public void TestPerfectCurveLastTwoPoints()
103
103
AddStep ( "select control point" , ( ) => visualiser . Pieces [ 3 ] . IsSelected . Value = true ) ;
104
104
addContextMenuItemStep ( "Perfect curve" ) ;
105
105
106
- assertControlPointPathType ( 0 , PathType . Bezier ) ;
106
+ assertControlPointPathType ( 0 , PathType . BEZIER ) ;
107
107
AddAssert ( "point 3 is not inherited" , ( ) => slider . Path . ControlPoints [ 3 ] . Type != null ) ;
108
108
}
109
109
@@ -112,7 +112,7 @@ public void TestPerfectCurveTooManyPointsLinear()
112
112
{
113
113
createVisualiser ( true ) ;
114
114
115
- addControlPointStep ( new Vector2 ( 200 ) , PathType . Linear ) ;
115
+ addControlPointStep ( new Vector2 ( 200 ) , PathType . LINEAR ) ;
116
116
addControlPointStep ( new Vector2 ( 300 ) ) ;
117
117
addControlPointStep ( new Vector2 ( 500 , 300 ) ) ;
118
118
addControlPointStep ( new Vector2 ( 700 , 200 ) ) ;
@@ -123,31 +123,55 @@ public void TestPerfectCurveTooManyPointsLinear()
123
123
AddStep ( "select control point" , ( ) => visualiser . Pieces [ 1 ] . IsSelected . Value = true ) ;
124
124
addContextMenuItemStep ( "Perfect curve" ) ;
125
125
126
- assertControlPointPathType ( 0 , PathType . Linear ) ;
127
- assertControlPointPathType ( 1 , PathType . PerfectCurve ) ;
128
- assertControlPointPathType ( 3 , PathType . Linear ) ;
126
+ assertControlPointPathType ( 0 , PathType . LINEAR ) ;
127
+ assertControlPointPathType ( 1 , PathType . PERFECT_CURVE ) ;
128
+ assertControlPointPathType ( 3 , PathType . LINEAR ) ;
129
129
}
130
130
131
131
[ Test ]
132
132
public void TestPerfectCurveChangeToBezier ( )
133
133
{
134
134
createVisualiser ( true ) ;
135
135
136
- addControlPointStep ( new Vector2 ( 200 ) , PathType . Bezier ) ;
137
- addControlPointStep ( new Vector2 ( 300 ) , PathType . PerfectCurve ) ;
136
+ addControlPointStep ( new Vector2 ( 200 ) , PathType . BEZIER ) ;
137
+ addControlPointStep ( new Vector2 ( 300 ) , PathType . PERFECT_CURVE ) ;
138
138
addControlPointStep ( new Vector2 ( 500 , 300 ) ) ;
139
- addControlPointStep ( new Vector2 ( 700 , 200 ) , PathType . Bezier ) ;
139
+ addControlPointStep ( new Vector2 ( 700 , 200 ) , PathType . BEZIER ) ;
140
140
addControlPointStep ( new Vector2 ( 500 , 100 ) ) ;
141
141
142
142
moveMouseToControlPoint ( 3 ) ;
143
143
AddStep ( "select control point" , ( ) => visualiser . Pieces [ 3 ] . IsSelected . Value = true ) ;
144
144
addContextMenuItemStep ( "Inherit" ) ;
145
145
146
- assertControlPointPathType ( 0 , PathType . Bezier ) ;
147
- assertControlPointPathType ( 1 , PathType . Bezier ) ;
146
+ assertControlPointPathType ( 0 , PathType . BEZIER ) ;
147
+ assertControlPointPathType ( 1 , PathType . BEZIER ) ;
148
148
assertControlPointPathType ( 3 , null ) ;
149
149
}
150
150
151
+ [ Test ]
152
+ public void TestCatmullAvailableIffSelectionContainsCatmull ( )
153
+ {
154
+ createVisualiser ( true ) ;
155
+
156
+ addControlPointStep ( new Vector2 ( 200 ) , PathType . CATMULL ) ;
157
+ addControlPointStep ( new Vector2 ( 300 ) ) ;
158
+ addControlPointStep ( new Vector2 ( 500 , 300 ) ) ;
159
+ addControlPointStep ( new Vector2 ( 700 , 200 ) ) ;
160
+ addControlPointStep ( new Vector2 ( 500 , 100 ) ) ;
161
+
162
+ moveMouseToControlPoint ( 2 ) ;
163
+ AddStep ( "select first and third control point" , ( ) =>
164
+ {
165
+ visualiser . Pieces [ 0 ] . IsSelected . Value = true ;
166
+ visualiser . Pieces [ 2 ] . IsSelected . Value = true ;
167
+ } ) ;
168
+ addContextMenuItemStep ( "Catmull" ) ;
169
+
170
+ assertControlPointPathType ( 0 , PathType . CATMULL ) ;
171
+ assertControlPointPathType ( 2 , PathType . CATMULL ) ;
172
+ assertControlPointPathType ( 4 , null ) ;
173
+ }
174
+
151
175
private void createVisualiser ( bool allowSelection ) => AddStep ( "create visualiser" , ( ) => Child = visualiser = new PathControlPointVisualiser < Slider > ( slider , allowSelection )
152
176
{
153
177
Anchor = Anchor . Centre ,
@@ -158,7 +182,7 @@ public void TestPerfectCurveChangeToBezier()
158
182
159
183
private void addControlPointStep ( Vector2 position , PathType ? type )
160
184
{
161
- AddStep ( $ "add { type } control point at { position } ", ( ) =>
185
+ AddStep ( $ "add { type ? . Type } control point at { position } ", ( ) =>
162
186
{
163
187
slider . Path . ControlPoints . Add ( new PathControlPoint ( position , type ) ) ;
164
188
} ) ;
0 commit comments