Skip to content

Commit af1a881

Browse files
authored
Merge pull request #8485 from aashu2006/test/webgl-3d-primitives
Add visual regression tests for WebGL 3D primitives
2 parents 11a62fa + 0e149f4 commit af1a881

9 files changed

Lines changed: 82 additions & 0 deletions

File tree

test/unit/visual/cases/webgl.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,76 @@ visualSuite('WebGL', function() {
12431243
});
12441244
});
12451245

1246+
visualSuite('3D Primitives', function() {
1247+
visualTest('cylinder() renders correctly', function(p5, screenshot) {
1248+
p5.createCanvas(100, 100, p5.WEBGL);
1249+
p5.background(255);
1250+
1251+
p5.ambientLight(100);
1252+
p5.directionalLight(255, 255, 255, 0, 0, -1);
1253+
1254+
p5.noStroke();
1255+
p5.fill(200);
1256+
1257+
p5.rotateX(p5.PI / 6);
1258+
p5.rotateY(p5.PI / 4);
1259+
1260+
p5.cylinder(30, 60);
1261+
screenshot();
1262+
});
1263+
1264+
visualTest('cone() renders correctly', function(p5, screenshot) {
1265+
p5.createCanvas(100, 100, p5.WEBGL);
1266+
p5.background(255);
1267+
1268+
p5.ambientLight(100);
1269+
p5.directionalLight(255, 255, 255, 0, 0, -1);
1270+
1271+
p5.noStroke();
1272+
p5.fill(200);
1273+
1274+
p5.rotateX(p5.PI / 6);
1275+
p5.rotateY(p5.PI / 4);
1276+
1277+
p5.cone(30, 60);
1278+
screenshot();
1279+
});
1280+
1281+
visualTest('ellipsoid() renders with non-uniform radii', function(p5, screenshot) {
1282+
p5.createCanvas(100, 100, p5.WEBGL);
1283+
p5.background(255);
1284+
1285+
p5.ambientLight(100);
1286+
p5.directionalLight(255, 255, 255, 0, 0, -1);
1287+
1288+
p5.noStroke();
1289+
p5.fill(200);
1290+
1291+
p5.rotateX(p5.PI / 6);
1292+
p5.rotateY(p5.PI / 4);
1293+
1294+
p5.ellipsoid(20, 30, 40);
1295+
screenshot();
1296+
});
1297+
1298+
visualTest('torus() renders correctly', function(p5, screenshot) {
1299+
p5.createCanvas(100, 100, p5.WEBGL);
1300+
p5.background(255);
1301+
1302+
p5.ambientLight(100);
1303+
p5.directionalLight(255, 255, 255, 0, 0, -1);
1304+
1305+
p5.noStroke();
1306+
p5.fill(200);
1307+
1308+
p5.rotateX(p5.PI / 6);
1309+
p5.rotateY(p5.PI / 4);
1310+
1311+
p5.torus(30, 10);
1312+
screenshot();
1313+
});
1314+
});
1315+
12461316
visualSuite('Tessellation', function() {
12471317
visualTest('Handles nearly identical consecutive vertices', function(p5, screenshot) {
12481318
p5.createCanvas(400, 400, p5.WEBGL);
3.17 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"numScreenshots": 1
3+
}
2.13 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"numScreenshots": 1
3+
}
3.75 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"numScreenshots": 1
3+
}
5.07 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"numScreenshots": 1
3+
}

0 commit comments

Comments
 (0)