Skip to content

Commit 5afc141

Browse files
committed
Adding CCNodeColor tests
1 parent e9099b5 commit 5afc141

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

cocos2d-ui-tests/tests/CCRendererTest.m

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,5 +365,77 @@ - (void)setupDrawNodeTest
365365
[self.contentNode addChild:draw];
366366
}
367367

368+
- (void)setupColorNodeTest
369+
{
370+
self.subTitle = @"Testing CCNodeColor/CCNodeGradient";
371+
372+
CCNodeColor *bg = [CCNodeColor nodeWithColor:[CCColor lightGrayColor]];
373+
[self.contentNode addChild:bg];
374+
375+
// Solid Colors
376+
{ // Red
377+
CCNodeColor *node = [CCNodeColor nodeWithColor:[CCColor colorWithRed:0.5 green:0.0 blue:0.0 alpha:0.25] width:100 height:100];
378+
node.positionType = CCPositionTypeNormalized;
379+
node.position = ccp(0.25, 0.3);
380+
node.anchorPoint = ccp(0.5, 0.5);
381+
382+
[self.contentNode addChild:node];
383+
}
384+
385+
{ // Green
386+
CCNodeColor *node = [CCNodeColor nodeWithColor:[CCColor colorWithRed:0.0 green:0.5 blue:0.0 alpha:0.25] width:100 height:100];
387+
node.positionType = CCPositionTypeNormalized;
388+
node.position = ccp(0.50, 0.3);
389+
node.anchorPoint = ccp(0.5, 0.5);
390+
391+
[self.contentNode addChild:node];
392+
}
393+
394+
{ // Blue
395+
CCNodeColor *node = [CCNodeColor nodeWithColor:[CCColor colorWithRed:0.0 green:0.0 blue:0.5 alpha:0.25] width:100 height:100];
396+
node.positionType = CCPositionTypeNormalized;
397+
node.position = ccp(0.75, 0.3);
398+
node.anchorPoint = ccp(0.5, 0.5);
399+
400+
[self.contentNode addChild:node];
401+
}
402+
403+
CCColor *clearWhite = [CCColor colorWithRed:1 green:1 blue:1 alpha:0];
404+
405+
// Gradients
406+
{ // Red
407+
CCNodeGradient *node = [CCNodeGradient nodeWithColor:[CCColor colorWithRed:0.5 green:0.0 blue:0.0 alpha:1.0] width:100 height:100];
408+
node.endColor = clearWhite;
409+
node.vector = ccp(1, 1);
410+
node.positionType = CCPositionTypeNormalized;
411+
node.position = ccp(0.25, 0.7);
412+
node.anchorPoint = ccp(0.5, 0.5);
413+
414+
[self.contentNode addChild:node];
415+
}
416+
417+
{ // Green
418+
CCNodeGradient *node = [CCNodeGradient nodeWithColor:[CCColor colorWithRed:0.0 green:0.5 blue:0.0 alpha:1.0] width:100 height:100];
419+
node.endColor = clearWhite;
420+
node.vector = ccp(0, 1);
421+
node.positionType = CCPositionTypeNormalized;
422+
node.position = ccp(0.50, 0.7);
423+
node.anchorPoint = ccp(0.5, 0.5);
424+
425+
[self.contentNode addChild:node];
426+
}
427+
428+
{ // Blue
429+
CCNodeGradient *node = [CCNodeGradient nodeWithColor:[CCColor colorWithRed:0.0 green:0.0 blue:0.5 alpha:1.0] width:100 height:100];
430+
node.endColor = clearWhite;
431+
node.vector = ccp(-1, 1);
432+
node.positionType = CCPositionTypeNormalized;
433+
node.position = ccp(0.75, 0.7);
434+
node.anchorPoint = ccp(0.5, 0.5);
435+
436+
[self.contentNode addChild:node];
437+
}
438+
}
439+
368440
@end
369441

0 commit comments

Comments
 (0)