Skip to content

Commit 4e12090

Browse files
author
Lauren McCarthy
committed
Merge pull request #883 from jedahan/colorMode-tests
Add unit test for blendMode()
2 parents a3f3031 + fb729b8 commit 4e12090

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

test/test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<script src="unit/core/core.js" type="text/javascript" ></script>
3636
<!--<script src="unit/core/2d_primitives.js" type="text/javascript" ></script>-->
3737
<script src="unit/core/curves.js" type="text/javascript" ></script>
38+
<script src="unit/core/renderer.js" type="text/javascript" ></script>
3839

3940
<script src="unit/math/calculation.js" type="text/javascript" ></script>
4041
<script src="unit/math/random.js" type="text/javascript" ></script>

test/unit/core/renderer.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
suite('Renderer', function() {
2+
3+
var myp5 = new p5(function( p ) {
4+
p.setup = function() {};
5+
p.draw = function() {};
6+
});
7+
8+
teardown(function(){
9+
myp5.clear();
10+
});
11+
12+
suite('p5.prototype.blendMode', function() {
13+
var blendMode = p5.prototype.blendMode;
14+
var drawX = function() {
15+
myp5.strokeWeight(30);
16+
myp5.stroke(80, 150, 255);
17+
myp5.line(25, 25, 75, 75);
18+
myp5.stroke(255, 50, 50);
19+
myp5.line(75, 25, 25, 75);
20+
};
21+
suite('blendMode()', function() {
22+
test('should be a function', function() {
23+
assert.ok(blendMode);
24+
assert.typeOf(blendMode, 'function');
25+
});
26+
test('should be able to ADD', function() {
27+
myp5.blendMode(myp5.ADD);
28+
drawX();
29+
});
30+
test('should be able to MULTIPLY', function() {
31+
myp5.blendMode(myp5.MULTIPLY);
32+
drawX();
33+
});
34+
35+
});
36+
});
37+
38+
});

0 commit comments

Comments
 (0)