Skip to content

Fix FES check for image() not accepting some valid types #7801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 17 additions & 58 deletions docs/parameterData.json
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@
"image": {
"overloads": [
[
"p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture",
"p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture|p5.Renderer|p5.Graphics",
"Number",
"Number",
"Number?",
Expand Down Expand Up @@ -1431,13 +1431,6 @@
]
]
},
"createMatrix": {
"overloads": [
[
"Number[]"
]
]
},
"noise": {
"overloads": [
[
Expand Down Expand Up @@ -1856,14 +1849,23 @@
},
"bezierOrder": {
"overloads": [
[],
[
"Number"
]
],
[]
]
},
"splineVertex": {
"overloads": [
[
"Number",
"Number"
],
[
"Number",
"Number",
"Number?"
],
[
"Number",
"Number",
Expand All @@ -1881,21 +1883,21 @@
},
"splineProperty": {
"overloads": [
[
"String"
],
[
"String",
null
],
[
"String"
]
]
},
"splineProperties": {
"overloads": [
[],
[
"Object"
]
],
[]
]
},
"vertex": {
Expand Down Expand Up @@ -1955,19 +1957,6 @@
]
]
},
"curveVertex": {
"overloads": [
[
"Number",
"Number"
],
[
"Number",
"Number",
"Number?"
]
]
},
"endShape": {
"overloads": [
[
Expand Down Expand Up @@ -2755,36 +2744,6 @@
]
]
},
"parseObj": {
"overloads": [
[]
]
},
"parseSTL": {
"overloads": [
[]
]
},
"isBinary": {
"overloads": [
[]
]
},
"matchDataViewAt": {
"overloads": [
[]
]
},
"parseBinarySTL": {
"overloads": [
[]
]
},
"parseASCIISTL": {
"overloads": [
[]
]
},
"model": {
"overloads": [
[
Expand Down
2 changes: 1 addition & 1 deletion src/image/loading_displaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ function loadingDisplaying(p5, fn){
* are set to `CENTER`.
*
* @method image
* @param {p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture} img image to display.
* @param {p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture|p5.Renderer|p5.Graphics} img image to display.
* @param {Number} x x-coordinate of the top-left corner of the image.
* @param {Number} y y-coordinate of the top-left corner of the image.
* @param {Number} [width] width to draw the image.
Expand Down
8 changes: 7 additions & 1 deletion test/unit/core/param_errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ suite('Validate Params', function () {
FramebufferTexture: function() {
return 'mock p5.FramebufferTexture';
},
Renderer: function() {
return 'mock p5.Renderer';
},
Graphics: function() {
return 'mock p5.Graphics';
},
_error: () => {},
};
const mockP5Prototype = {};
Expand Down Expand Up @@ -124,7 +130,7 @@ suite('Validate Params', function () {
console.log(result);
assert.equal(
result.error,
'🌸 p5.js says: Did you mean to put `await` before a loading function? An unexpected Promise was found. Expected Image or Element or Texture or Framebuffer or FramebufferTexture at the first parameter in p5.image().'
'🌸 p5.js says: Did you mean to put `await` before a loading function? An unexpected Promise was found. Expected Image or Element or Texture or Framebuffer or FramebufferTexture or Renderer or Graphics at the first parameter in p5.image().'
);
});
});
Expand Down