Skip to content

Commit f23b52e

Browse files
committed
Update progress node tests.
1 parent 75a04e6 commit f23b52e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

cocos2d-ui-tests/tests/CCRendererTest.m

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ - (void)setupMotionStreakNodeTest
125125
}
126126
}
127127

128+
static float
129+
ProgressPercent(CCTime t)
130+
{
131+
return 100.0*fmod(t, 1.0);
132+
}
133+
128134
- (void)setupProgressNodeTest
129135
{
130136
self.subTitle = @"Testing various CCProgressNode setups.";
@@ -148,7 +154,7 @@ - (void)setupProgressNodeTest
148154
[self.contentNode addChild:progress];
149155

150156
[self scheduleBlock:^(CCTimer *timer) {
151-
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
157+
progress.percentage = ProgressPercent(timer.invokeTime);
152158
[timer repeatOnceWithInterval:interval];
153159
} delay:interval];
154160
}
@@ -173,7 +179,7 @@ - (void)setupProgressNodeTest
173179

174180
[self scheduleBlock:^(CCTimer *timer) {
175181
progress.midpoint = ccpAdd(ccp(0.5, 0.5), ccpMult(ccpForAngle(timer.invokeTime), 0.25));
176-
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
182+
progress.percentage = ProgressPercent(timer.invokeTime);
177183

178184
[timer repeatOnceWithInterval:interval];
179185
} delay:interval];
@@ -199,7 +205,7 @@ - (void)setupProgressNodeTest
199205
[self.contentNode addChild:progress];
200206

201207
[self scheduleBlock:^(CCTimer *timer) {
202-
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
208+
progress.percentage = ProgressPercent(timer.invokeTime);
203209

204210
[timer repeatOnceWithInterval:interval];
205211
} delay:interval];
@@ -225,7 +231,7 @@ - (void)setupProgressNodeTest
225231
[self.contentNode addChild:progress];
226232

227233
[self scheduleBlock:^(CCTimer *timer) {
228-
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
234+
progress.percentage = ProgressPercent(timer.invokeTime);
229235

230236
[timer repeatOnceWithInterval:interval];
231237
} delay:interval];
@@ -251,7 +257,7 @@ - (void)setupProgressNodeTest
251257
[self.contentNode addChild:progress];
252258

253259
[self scheduleBlock:^(CCTimer *timer) {
254-
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
260+
progress.percentage = ProgressPercent(timer.invokeTime);
255261

256262
[timer repeatOnceWithInterval:interval];
257263
} delay:interval];
@@ -277,7 +283,7 @@ - (void)setupProgressNodeTest
277283
[self.contentNode addChild:progress];
278284

279285
[self scheduleBlock:^(CCTimer *timer) {
280-
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
286+
progress.percentage = ProgressPercent(timer.invokeTime);
281287

282288
[timer repeatOnceWithInterval:interval];
283289
} delay:interval];
@@ -303,7 +309,7 @@ - (void)setupProgressNodeTest
303309
[self.contentNode addChild:progress];
304310

305311
[self scheduleBlock:^(CCTimer *timer) {
306-
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
312+
progress.percentage = ProgressPercent(timer.invokeTime);
307313

308314
[timer repeatOnceWithInterval:interval];
309315
} delay:interval];
@@ -329,7 +335,7 @@ - (void)setupProgressNodeTest
329335
[self.contentNode addChild:progress];
330336

331337
[self scheduleBlock:^(CCTimer *timer) {
332-
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
338+
progress.percentage = ProgressPercent(timer.invokeTime);
333339

334340
[timer repeatOnceWithInterval:interval];
335341
} delay:interval];

0 commit comments

Comments
 (0)