From 59c65835d7b8bbba326742982108d3167506e944 Mon Sep 17 00:00:00 2001 From: ksen0 Date: Mon, 20 Oct 2025 12:53:08 +0200 Subject: [PATCH 1/2] Updated 1.x manual tests --- .../async/loadJSON_callback/sketch.js | 9 ++++----- .../async/loadJSON_options/sketch.js | 2 +- .../async/loadJSON_preload/sketch.js | 10 +++++----- test/manual-test-examples/keyboard/keyIsPressed.html | 1 + 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/manual-test-examples/async/loadJSON_callback/sketch.js b/test/manual-test-examples/async/loadJSON_callback/sketch.js index 85517d7377..43f663f455 100644 --- a/test/manual-test-examples/async/loadJSON_callback/sketch.js +++ b/test/manual-test-examples/async/loadJSON_callback/sketch.js @@ -36,9 +36,8 @@ function getWeather() { var cityName = userInput.value(); var URL = - 'http://api.openweathermap.org/data/2.5/weather?q=' + - cityName + - '&units=metric'; + 'https://wttr.in/' + encodeURIComponent(cityName) + '?format=j1'; + result = loadJSON(URL, displayWeather); // displayWeather is the callback } @@ -47,9 +46,9 @@ function displayWeather() { print(result); // result is ready! var location = result.name; - var currentTemp = result.main.temp; + var avgTemp = result.weather[0].avgtempC; text( - 'Current temperature in ' + location + ' is ' + currentTemp + ' celsius', + 'Today\'s average temperature in ' + location + ' is ' + avgTemp + ' celsius', width / 2, height / 2 ); diff --git a/test/manual-test-examples/async/loadJSON_options/sketch.js b/test/manual-test-examples/async/loadJSON_options/sketch.js index c3a154920b..170d3d9026 100644 --- a/test/manual-test-examples/async/loadJSON_options/sketch.js +++ b/test/manual-test-examples/async/loadJSON_options/sketch.js @@ -1,7 +1,7 @@ function setup() { noCanvas(); loadJSON( - 'http://api.openweathermap.org/data/2.5/station?id=5091', + 'https://wttr.in/Berlin?format=j1', parseStuff, 'json' ); diff --git a/test/manual-test-examples/async/loadJSON_preload/sketch.js b/test/manual-test-examples/async/loadJSON_preload/sketch.js index 59871f908a..9d63de2e99 100644 --- a/test/manual-test-examples/async/loadJSON_preload/sketch.js +++ b/test/manual-test-examples/async/loadJSON_preload/sketch.js @@ -1,5 +1,5 @@ // In this example, we want to load JSON (a JavaScript Object) -// from a URL at openweathermap.org, and display it in setup(). +// from a URL at wttr.in, and display it in setup(). // // Since setup() happens faster than you can load a website, the // data does not have time to properly load before setup() is done. @@ -13,7 +13,7 @@ var result; function preload() { result = loadJSON( - 'http://api.openweathermap.org/data/2.5/weather?id=5128581&units=imperial' + 'https://wttr.in/Berlin?format=j1' ); console.log('In preload(), the result has not finished loading: '); console.log(result); @@ -29,10 +29,10 @@ function setup() { console.log('In setup(), here is the result: '); console.log(result); - var location = result.name; - var currentTemp = result.main.temp; + var location = result.nearest_area[0].areaName[0].value; + var avgTemp = result.weather[0].avgtempC; text( - 'Current temperature in ' + location + ' is ' + currentTemp + 'F', + 'Today\'s average temperature in ' + location + ' is ' + avgTemp + ' celsius', width / 2, height / 2 ); diff --git a/test/manual-test-examples/keyboard/keyIsPressed.html b/test/manual-test-examples/keyboard/keyIsPressed.html index 16a7e3b813..ca51f284cc 100644 --- a/test/manual-test-examples/keyboard/keyIsPressed.html +++ b/test/manual-test-examples/keyboard/keyIsPressed.html @@ -6,5 +6,6 @@ +

Press the arrow keys, colors should change.

From 629e9d7ef9f2dcff709e9dfcdd9f25ca549facee Mon Sep 17 00:00:00 2001 From: ksen0 Date: Mon, 20 Oct 2025 15:12:21 +0200 Subject: [PATCH 2/2] Update radio input manual test --- test/manual-test-examples/dom/radio_test/sketch.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/manual-test-examples/dom/radio_test/sketch.js b/test/manual-test-examples/dom/radio_test/sketch.js index 33cbbd6105..9b6c804181 100644 --- a/test/manual-test-examples/dom/radio_test/sketch.js +++ b/test/manual-test-examples/dom/radio_test/sketch.js @@ -5,13 +5,13 @@ function setup() { radio.id('test'); //radio = createSelect(); // for comparison - // just mucking around + // The first is the value; the second is the optional label radio.option('apple', '1'); radio.option('orange', '2'); radio.option('pear'); // Set what it starts as - radio.selected('2'); + radio.selected('orange'); radio.changed(mySelectEvent); } @@ -24,7 +24,7 @@ function draw() { } function mySelectEvent() { - var selected = this.selected(); + var selected = this.selected().value; console.log(this.value()); if (selected === 'pear') { console.log("it's a pear!");