From dc085abb06ae0a650136cd484f378465b0cf8568 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 9 May 2023 03:06:39 -0400 Subject: [PATCH] fix(owm): adjust icons outside of the MD range --- src/segments/owm.go | 16 ++++++++-------- src/segments/owm_test.go | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/segments/owm.go b/src/segments/owm.go index a7a41d70..0e4a5f91 100644 --- a/src/segments/owm.go +++ b/src/segments/owm.go @@ -112,13 +112,13 @@ func (d *Owm) setStatus() error { icon := "" switch id { case "01n": - fallthrough + icon = "\ue32b" case "01d": - icon = "\U000f0599" + icon = "\ue30d" case "02n": - fallthrough + icon = "\ue37e" case "02d": - icon = "\ufa94" + icon = "\ue302" case "03n": fallthrough case "03d": @@ -130,15 +130,15 @@ func (d *Owm) setStatus() error { case "09n": fallthrough case "09d": - icon = "\U000f0596" + icon = "\ue319" case "10n": - fallthrough + icon = "\ue325" case "10d": icon = "\ue308" case "11n": - fallthrough + icon = "\ue32a" case "11d": - icon = "\ue31d" + icon = "\ue30f" case "13n": fallthrough case "13d": diff --git a/src/segments/owm_test.go b/src/segments/owm_test.go index 2d2f73cb..681d431f 100644 --- a/src/segments/owm_test.go +++ b/src/segments/owm_test.go @@ -27,20 +27,20 @@ func TestOWMSegmentSingle(t *testing.T) { { Case: "Sunny Display", JSONResponse: `{"weather":[{"icon":"01d"}],"main":{"temp":20}}`, - ExpectedString: "\U000f0599 (20°C)", + ExpectedString: "\ue30d (20°C)", ExpectedEnabled: true, }, { Case: "Sunny Display", JSONResponse: `{"weather":[{"icon":"01d"}],"main":{"temp":20}}`, - ExpectedString: "\U000f0599 (20°C)", + ExpectedString: "\ue30d (20°C)", ExpectedEnabled: true, Template: "{{.Weather}} ({{.Temperature}}{{.UnitIcon}})", }, { Case: "Sunny Display", JSONResponse: `{"weather":[{"icon":"01d"}],"main":{"temp":20}}`, - ExpectedString: "\U000f0599", + ExpectedString: "\ue30d", ExpectedEnabled: true, Template: "{{.Weather}} ", }, @@ -90,12 +90,12 @@ func TestOWMSegmentIcons(t *testing.T) { { Case: "Sunny Display day", IconID: "01d", - ExpectedIconString: "\U000f0599", + ExpectedIconString: "\ue30d", }, { Case: "Light clouds Display day", IconID: "02d", - ExpectedIconString: "\ufa94", + ExpectedIconString: "\ue302", }, { Case: "Cloudy Display day", @@ -110,7 +110,7 @@ func TestOWMSegmentIcons(t *testing.T) { { Case: "Shower Rain Display day", IconID: "09d", - ExpectedIconString: "\U000f0596", + ExpectedIconString: "\ue319", }, { Case: "Rain Display day", @@ -120,7 +120,7 @@ func TestOWMSegmentIcons(t *testing.T) { { Case: "Thunderstorm Display day", IconID: "11d", - ExpectedIconString: "\ue31d", + ExpectedIconString: "\ue30f", }, { Case: "Snow Display day", @@ -136,12 +136,12 @@ func TestOWMSegmentIcons(t *testing.T) { { Case: "Sunny Display night", IconID: "01n", - ExpectedIconString: "\U000f0599", + ExpectedIconString: "\ue32b", }, { Case: "Light clouds Display night", IconID: "02n", - ExpectedIconString: "\ufa94", + ExpectedIconString: "\ue37e", }, { Case: "Cloudy Display night", @@ -156,17 +156,17 @@ func TestOWMSegmentIcons(t *testing.T) { { Case: "Shower Rain Display night", IconID: "09n", - ExpectedIconString: "\U000f0596", + ExpectedIconString: "\ue319", }, { Case: "Rain Display night", IconID: "10n", - ExpectedIconString: "\ue308", + ExpectedIconString: "\ue325", }, { Case: "Thunderstorm Display night", IconID: "11n", - ExpectedIconString: "\ue31d", + ExpectedIconString: "\ue32a", }, { Case: "Snow Display night", @@ -227,7 +227,7 @@ func TestOWMSegmentIcons(t *testing.T) { } func TestOWMSegmentFromCache(t *testing.T) { response := fmt.Sprintf(`{"weather":[{"icon":"%s"}],"main":{"temp":20}}`, "01d") - expectedString := fmt.Sprintf("%s (20°C)", "\U000f0599") + expectedString := fmt.Sprintf("%s (20°C)", "\ue30d") env := &mock.MockedEnvironment{} cache := &mock.MockedCache{} @@ -250,7 +250,7 @@ func TestOWMSegmentFromCache(t *testing.T) { func TestOWMSegmentFromCacheWithHyperlink(t *testing.T) { response := fmt.Sprintf(`{"weather":[{"icon":"%s"}],"main":{"temp":20}}`, "01d") - expectedString := fmt.Sprintf("«%s (20°C)»(http://api.openweathermap.org/data/2.5/weather?q=AMSTERDAM,NL&units=metric&appid=key)", "\U000f0599") + expectedString := fmt.Sprintf("«%s (20°C)»(http://api.openweathermap.org/data/2.5/weather?q=AMSTERDAM,NL&units=metric&appid=key)", "\ue30d") env := &mock.MockedEnvironment{} cache := &mock.MockedCache{}