Skip to content

Commit fe03794

Browse files
author
Lauren McCarthy
committed
updating test file names to match src/ filenames
1 parent 83ff8a7 commit fe03794

File tree

12 files changed

+85
-129
lines changed

12 files changed

+85
-129
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
suite('Renderer', function() {
1+
suite('Rendering', function() {
22
var myp5;
33

44
setup(function(done) {

test/unit/spec.js

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,21 @@ var spec = {
33
color: ['color_conversion', 'creating_reading', 'p5.Color', 'setting'],
44
core: [
55
'2d_primitives',
6-
'core',
76
'curves',
8-
'element',
7+
'environment',
98
'error_helpers',
10-
'graphics',
11-
'renderer',
9+
'main',
10+
'p5.Element',
11+
'rendering',
1212
'structure'
1313
],
14-
data: ['dictionary'],
14+
data: ['p5.TypedDict'],
1515
image: ['loading', 'pixels'],
16-
io: ['files_input'],
16+
io: ['files'],
1717
math: ['calculation', 'noise', 'p5.Vector', 'random', 'trigonometry'],
18-
typography: ['font_loading'],
18+
typography: ['loading_displaying'],
1919
utilities: ['array_functions', 'string_functions', 'time_date'],
20-
webgl: [
21-
'matrix',
22-
'p5.Camera',
23-
'p5.RendererGL',
24-
'p5.Shader',
25-
'p5.Texture',
26-
'pixels',
27-
'stroke'
28-
]
20+
webgl: ['p5.Matrix', 'p5.Camera', 'p5.RendererGL', 'p5.Shader', 'p5.Texture']
2921
};
3022
Object.keys(spec).map(function(folder) {
3123
spec[folder].map(function(file) {
File renamed without changes.

test/unit/webgl/p5.RendererGL.js

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ suite('p5.RendererGL', function() {
77

88
setup(function() {
99
myp5 = new p5(function(p) {
10-
p.setup = function() {
11-
p.createCanvas(100, 100, p.WEBGL);
12-
};
10+
p.setup = function() {};
11+
p.draw = function() {};
1312
});
1413
});
1514

@@ -19,7 +18,81 @@ suite('p5.RendererGL', function() {
1918

2019
suite('createCanvas(w, h, WEBGL)', function() {
2120
test('creates a p5.RendererGL renderer', function() {
21+
myp5.createCanvas(100, 100, myp5.WEBGL);
2222
assert.instanceOf(myp5._renderer, p5.RendererGL);
2323
});
2424
});
25+
26+
suite('default stroke shader', function() {
27+
test('check default shader creation', function(done) {
28+
myp5.createCanvas(100, 100, myp5.WEBGL);
29+
assert(
30+
myp5._renderer.curStrokeShader === myp5._renderer._getLineShader(),
31+
'default stroke shader was not initialized with GL canvas'
32+
);
33+
assert(
34+
myp5._renderer.curFillShader === myp5._renderer._getColorShader(),
35+
'default fill shader was not initialized with GL canvas'
36+
);
37+
done();
38+
});
39+
40+
test('check activate and deactivating fill and stroke', function(done) {
41+
myp5.noStroke();
42+
assert(
43+
!myp5._renderer._doStroke,
44+
'stroke shader still active after noStroke()'
45+
);
46+
assert.isTrue(
47+
myp5._renderer._doFill,
48+
'fill shader deactivated by noStroke()'
49+
);
50+
myp5.stroke(0);
51+
myp5.noFill();
52+
assert(
53+
myp5._renderer._doStroke,
54+
'stroke shader not active after stroke()'
55+
);
56+
assert.isTrue(
57+
!myp5._renderer._doFill,
58+
'fill shader still active after noFill()'
59+
);
60+
done();
61+
});
62+
});
63+
64+
suite('loadpixels()', function() {
65+
test('loadPixels color check', function(done) {
66+
myp5.createCanvas(100, 100, myp5.WEBGL);
67+
myp5.background(0, 100, 0);
68+
myp5.loadPixels();
69+
var pixels = myp5.pixels;
70+
assert.deepEqual(pixels[1], 100);
71+
assert.deepEqual(pixels[3], 255);
72+
done();
73+
});
74+
});
75+
76+
suite('get()', function() {
77+
myp5.createCanvas(100, 100, myp5.WEBGL);
78+
var img;
79+
test('get() size check', function(done) {
80+
img = myp5.get();
81+
assert.deepEqual(img.width, myp5.width);
82+
done();
83+
});
84+
85+
test('get() can create p5.Image', function(done) {
86+
assert.isTrue(img instanceof p5.Image);
87+
done();
88+
});
89+
90+
test('get() singlePixel color and size', function(done) {
91+
myp5.background(100, 115, 100);
92+
img = myp5.get(0, 0);
93+
assert.isTrue(img[1] === 115);
94+
assert.isTrue(img.length === 4);
95+
done();
96+
});
97+
});
2598
});

0 commit comments

Comments
 (0)