From 6275cfd98fed9218787ac648291ffa9bedd926e7 Mon Sep 17 00:00:00 2001 From: vansh kabra <vanshkabra05@gmail.com> Date: Sat, 19 Apr 2025 21:29:02 +0530 Subject: [PATCH] fix: add customShapes in Graphics.js and fix unit test error --- src/core/p5.Graphics.js | 2 ++ test/unit/core/p5.Graphics.js | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/core/p5.Graphics.js b/src/core/p5.Graphics.js index 751ec51fde..42fdaa496b 100644 --- a/src/core/p5.Graphics.js +++ b/src/core/p5.Graphics.js @@ -23,6 +23,7 @@ import material from '../webgl/material'; import creatingReading from '../color/creating_reading'; import trigonometry from '../math/trigonometry'; import { renderers } from './rendering'; +import customShapes from '../shape/custom_shapes'; class Graphics { constructor(w, h, renderer, pInst, canvas) { @@ -677,6 +678,7 @@ function graphics(p5, fn){ attributes(p5, p5.Graphics.prototype); curves(p5, p5.Graphics.prototype); vertex(p5, p5.Graphics.prototype); + customShapes(p5, p5.Graphics.prototype); setting(p5, p5.Graphics.prototype); loadingDisplaying(p5, p5.Graphics.prototype); diff --git a/test/unit/core/p5.Graphics.js b/test/unit/core/p5.Graphics.js index 3f73c4b682..890e1d41f5 100644 --- a/test/unit/core/p5.Graphics.js +++ b/test/unit/core/p5.Graphics.js @@ -117,6 +117,14 @@ suite('Graphics', function() { }); }); + suite('p5.Graphics.prototype.splineVertex', function() { + test('should be a function in graphics', function() { + let g = myp5.createGraphics(10, 10); + assert.ok(g.splineVertex); + assert.typeOf(g.splineVertex, 'function'); + }); + }); + suite('p5.Graphics.resizeCanvas', function() { let glStub;