1
1
import { mockP5 , mockP5Prototype } from '../../js/mocks' ;
2
2
import outputs from '../../../src/accessibility/outputs' ;
3
3
import textOutput from '../../../src/accessibility/textOutput' ;
4
+ import p5 from '../../../src/app.js' ;
4
5
5
6
// TODO: Is it possible to test this without a runtime?
6
7
suite ( 'outputs' , function ( ) {
@@ -17,10 +18,36 @@ suite('outputs', function() {
17
18
assert . typeOf ( mockP5Prototype . textOutput , 'function' ) ;
18
19
} ) ;
19
20
21
+ test ( 'should not break for webgl' , async function ( ) {
22
+ await new Promise ( ( res ) => {
23
+ new p5 ( ( p ) => {
24
+ p . setup = function ( ) {
25
+ p . createCanvas ( 50 , 50 , p . WEBGL ) ;
26
+ p . textOutput ( ) ;
27
+ p . circle ( 0 , 0 , 20 ) ;
28
+ res ( ) ;
29
+ } ;
30
+ } ) ;
31
+ } ) ;
32
+ } ) ;
33
+
34
+ test ( 'should not break for webgl' , async function ( ) {
35
+ await new Promise ( ( res ) => {
36
+ new p5 ( ( p ) => {
37
+ p . setup = function ( ) {
38
+ p . createCanvas ( 50 , 50 , p . WEBGL ) ;
39
+ p . gridOutput ( ) ;
40
+ p . circle ( 0 , 0 , 20 ) ;
41
+ res ( ) ;
42
+ } ;
43
+ } ) ;
44
+ } ) ;
45
+ } ) ;
46
+
20
47
let expected =
21
48
'Your output is a, 100 by 100 pixels, white canvas containing the following shape:' ;
22
49
23
- test . todo ( 'should create output as fallback' , function ( ) {
50
+ test ( 'should create output as fallback' , function ( ) {
24
51
return new Promise ( function ( resolve , reject ) {
25
52
let actual = '' ;
26
53
new p5 ( function ( p ) {
@@ -46,7 +73,7 @@ suite('outputs', function() {
46
73
} ) ;
47
74
} ) ;
48
75
49
- test . todo ( 'should create output as label' , function ( ) {
76
+ test ( 'should create output as label' , function ( ) {
50
77
return new Promise ( function ( resolve , reject ) {
51
78
let label = '' ;
52
79
let fallback = '' ;
@@ -76,7 +103,7 @@ suite('outputs', function() {
76
103
} ) ;
77
104
} ) ;
78
105
79
- test . todo ( 'should create text output for arc()' , function ( ) {
106
+ test ( 'should create text output for arc()' , function ( ) {
80
107
return new Promise ( function ( resolve , reject ) {
81
108
expected =
82
109
'<li><a href="#myCanvasIDtextOutputshape0">red arc</a>, at middle, covering 31% of the canvas.</li>' ;
@@ -104,7 +131,7 @@ suite('outputs', function() {
104
131
} ) ;
105
132
} ) ;
106
133
107
- test . todo ( 'should create text output for ellipse()' , function ( ) {
134
+ test ( 'should create text output for ellipse()' , function ( ) {
108
135
return new Promise ( function ( resolve , reject ) {
109
136
expected =
110
137
'<li><a href="#myCanvasIDtextOutputshape0">green circle</a>, at middle, covering 24% of the canvas.</li>' ;
@@ -132,7 +159,7 @@ suite('outputs', function() {
132
159
} ) ;
133
160
} ) ;
134
161
135
- test . todo ( 'should create text output for triangle()' , function ( ) {
162
+ test ( 'should create text output for triangle()' , function ( ) {
136
163
return new Promise ( function ( resolve , reject ) {
137
164
expected =
138
165
'<li><a href="#myCanvasIDtextOutputshape0">green triangle</a>, at top left, covering 13% of the canvas.</li>' ;
@@ -170,7 +197,7 @@ suite('outputs', function() {
170
197
let expected =
171
198
'white canvas, 100 by 100 pixels, contains 1 shape: 1 square' ;
172
199
173
- test . todo ( 'should create output as fallback' , function ( ) {
200
+ test ( 'should create output as fallback' , function ( ) {
174
201
return new Promise ( function ( resolve , reject ) {
175
202
let actual = '' ;
176
203
new p5 ( function ( p ) {
@@ -196,7 +223,7 @@ suite('outputs', function() {
196
223
} ) ;
197
224
} ) ;
198
225
199
- test . todo ( 'should create output as label' , function ( ) {
226
+ test ( 'should create output as label' , function ( ) {
200
227
return new Promise ( function ( resolve , reject ) {
201
228
let label = '' ;
202
229
let fallback = '' ;
@@ -226,7 +253,7 @@ suite('outputs', function() {
226
253
} ) ;
227
254
} ) ;
228
255
229
- test . todo ( 'should create text output for quad()' , function ( ) {
256
+ test ( 'should create text output for quad()' , function ( ) {
230
257
return new Promise ( function ( resolve , reject ) {
231
258
expected = 'red quadrilateral, location = top left, area = 45 %' ;
232
259
new p5 ( function ( p ) {
@@ -253,7 +280,7 @@ suite('outputs', function() {
253
280
} ) ;
254
281
} ) ;
255
282
256
- test . todo ( 'should create text output for point()' , function ( ) {
283
+ test ( 'should create text output for point()' , function ( ) {
257
284
return new Promise ( function ( resolve , reject ) {
258
285
expected = 'dark fuchsia point, location = bottom right' ;
259
286
new p5 ( function ( p ) {
@@ -280,7 +307,7 @@ suite('outputs', function() {
280
307
} ) ;
281
308
} ) ;
282
309
283
- test . todo ( 'should create text output for triangle()' , function ( ) {
310
+ test ( 'should create text output for triangle()' , function ( ) {
284
311
return new Promise ( function ( resolve , reject ) {
285
312
expected = 'green triangle, location = top left, area = 13 %' ;
286
313
new p5 ( function ( p ) {
0 commit comments