GNOME Bugzilla – Bug 791307
Add tests for timezone validity
Last modified: 2017-12-07 00:29:49 UTC
And correct the bugs it shows
Created attachment 365109 [details] [review] GWeatherLocation: Add API to get timezone as string Make it possible to get the timezone of a location as a string. This will be used to verify the timezone's validity, as _get_timezone() would return NULL, whether the location had no timezone, or if it had an invalid timezone.
Created attachment 365110 [details] [review] GWeatherTimezone: Add guard to gweather_timezone_get_by_tzid() This led to a crash in my badly written test code, a g_warning() is more useful to show incorrect API usage.
Created attachment 365111 [details] [review] tests: Add comment to named-timezones test Not that interesting, but useful nonetheless.
Created attachment 365112 [details] [review] tests: Add tests for timezone validity For every location at the country level, or smaller, check whether we have at least one timezone defined. If only one timezone is defined for the location, verify its validity. This generated 3 errors: (MSG: Location 'Anywhere on Earth (AoE)' has invalid timezone 'Etc/UTC-12') (MSG: Location 'Wake Island, Wake Island Army Airfield Airport' does not have an associated timezone) (MSG: Location 'Wake Island, Wake Island Army Airfield Airport' does not have an associated timezone)
Created attachment 365113 [details] [review] locations: Correct AoE timezone Etc/UTC-12 does not exist in tzdata, it's called Etc/GMT-12. This fixes an error in gnome-clocks: org.gnome.Clocks-WARNING **: world.vala:271: Timezone not defined for (null). This is a bug in libgweather database
Created attachment 365114 [details] [review] locations: Add tz-hint for Wake Island airfield Fixes test errors: (MSG: Location 'Wake Island, Wake Island Army Airfield Airport' does not have an associated timezone) (MSG: Location 'Wake Island, Wake Island Army Airfield Airport' does not have an associated timezone)
I committed those fixes already. Let me know what you think of the test case and the API addition it requires. Attachment 365110 [details] pushed as 10f1bf6 - GWeatherTimezone: Add guard to gweather_timezone_get_by_tzid() Attachment 365111 [details] pushed as 6969e49 - tests: Add comment to named-timezones test Attachment 365113 [details] pushed as 9980fcf - locations: Correct AoE timezone Attachment 365114 [details] pushed as 5847472 - locations: Add tz-hint for Wake Island airfield
Attachment 365109 [details] pushed as f84ea76 - GWeatherLocation: Add API to get timezone as string Attachment 365112 [details] pushed as 2dab8a8 - tests: Add tests for timezone validity