Skip to content

Commit f8e1c32

Browse files
authored
Merge pull request #8168 from processing/manual-tests-2
Updated 1.x manual tests
2 parents aa73cea + d8af6ee commit f8e1c32

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

test/manual-test-examples/async/loadJSON_callback/sketch.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ function getWeather() {
3636

3737
var cityName = userInput.value();
3838
var URL =
39-
'http://api.openweathermap.org/data/2.5/weather?q=' +
40-
cityName +
41-
'&units=metric';
39+
'https://wttr.in/' + encodeURIComponent(cityName) + '?format=j1';
40+
4241
result = loadJSON(URL, displayWeather); // displayWeather is the callback
4342
}
4443

@@ -47,9 +46,9 @@ function displayWeather() {
4746
print(result); // result is ready!
4847

4948
var location = result.name;
50-
var currentTemp = result.main.temp;
49+
var avgTemp = result.weather[0].avgtempC;
5150
text(
52-
'Current temperature in ' + location + ' is ' + currentTemp + ' celsius',
51+
'Today\'s average temperature in ' + location + ' is ' + avgTemp + ' celsius',
5352
width / 2,
5453
height / 2
5554
);

test/manual-test-examples/async/loadJSON_options/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function setup() {
22
noCanvas();
33
loadJSON(
4-
'http://api.openweathermap.org/data/2.5/station?id=5091',
4+
'https://wttr.in/Berlin?format=j1',
55
parseStuff,
66
'json'
77
);

test/manual-test-examples/async/loadJSON_preload/sketch.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// In this example, we want to load JSON (a JavaScript Object)
2-
// from a URL at openweathermap.org, and display it in setup().
2+
// from a URL at wttr.in, and display it in setup().
33
//
44
// Since setup() happens faster than you can load a website, the
55
// data does not have time to properly load before setup() is done.
@@ -13,7 +13,7 @@ var result;
1313

1414
function preload() {
1515
result = loadJSON(
16-
'http://api.openweathermap.org/data/2.5/weather?id=5128581&units=imperial'
16+
'https://wttr.in/Berlin?format=j1'
1717
);
1818
console.log('In preload(), the result has not finished loading: ');
1919
console.log(result);
@@ -29,10 +29,10 @@ function setup() {
2929
console.log('In setup(), here is the result: ');
3030
console.log(result);
3131

32-
var location = result.name;
33-
var currentTemp = result.main.temp;
32+
var location = result.nearest_area[0].areaName[0].value;
33+
var avgTemp = result.weather[0].avgtempC;
3434
text(
35-
'Current temperature in ' + location + ' is ' + currentTemp + 'F',
35+
'Today\'s average temperature in ' + location + ' is ' + avgTemp + ' celsius',
3636
width / 2,
3737
height / 2
3838
);

test/manual-test-examples/dom/radio_test/sketch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ function setup() {
55
radio.id('test');
66
//radio = createSelect(); // for comparison
77

8-
// just mucking around
8+
// The first is the value; the second is the optional label
99
radio.option('apple', '1');
1010
radio.option('orange', '2');
1111
radio.option('pear');
1212

1313
// Set what it starts as
14-
radio.selected('2');
14+
radio.selected('orange');
1515

1616
radio.changed(mySelectEvent);
1717
}
@@ -24,7 +24,7 @@ function draw() {
2424
}
2525

2626
function mySelectEvent() {
27-
var selected = this.selected();
27+
var selected = this.selected().value;
2828
console.log(this.value());
2929
if (selected === 'pear') {
3030
console.log("it's a pear!");

test/manual-test-examples/keyboard/keyIsPressed.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
</head>
77

88
<body>
9+
<p>Press the arrow keys, colors should change.</p>
910
</body>
1011
</html>

0 commit comments

Comments
 (0)