fix: remove incorrect percentage indicator

This commit is contained in:
Jan De Dobbeleer 2020-09-15 13:21:28 +02:00
parent 9b9405978e
commit 2791b180b2
3 changed files with 5 additions and 5 deletions

View file

@ -67,7 +67,7 @@
"charged_color": "#4caf50", "charged_color": "#4caf50",
"charging_color": "#40c4ff", "charging_color": "#40c4ff",
"discharging_color": "#ff5722", "discharging_color": "#ff5722",
"postfix": "% " "postfix": " "
} }
}, },
{ {

View file

@ -38,7 +38,7 @@ func (b *batt) string() string {
return "BATT ERR" return "BATT ERR"
} }
batteryPercentage := bt.Current / bt.Full * 100 batteryPercentage := bt.Current / bt.Full * 100
percentageText := fmt.Sprintf("%.0f%%", batteryPercentage) percentageText := fmt.Sprintf("%.0f", batteryPercentage)
var icon string var icon string
var colorPorperty Property var colorPorperty Property
switch bt.State { switch bt.State {

View file

@ -39,7 +39,7 @@ func TestBatteryCharging(t *testing.T) {
}, },
} }
b := setupBatteryTests(battery.Charging, 80, props) b := setupBatteryTests(battery.Charging, 80, props)
assert.Equal(t, "charging 80%", b.string()) assert.Equal(t, "charging 80", b.string())
} }
func TestBatteryCharged(t *testing.T) { func TestBatteryCharged(t *testing.T) {
@ -49,7 +49,7 @@ func TestBatteryCharged(t *testing.T) {
}, },
} }
b := setupBatteryTests(battery.Full, 100, props) b := setupBatteryTests(battery.Full, 100, props)
assert.Equal(t, "charged 100%", b.string()) assert.Equal(t, "charged 100", b.string())
} }
func TestBatteryDischarging(t *testing.T) { func TestBatteryDischarging(t *testing.T) {
@ -59,7 +59,7 @@ func TestBatteryDischarging(t *testing.T) {
}, },
} }
b := setupBatteryTests(battery.Discharging, 70, props) b := setupBatteryTests(battery.Discharging, 70, props)
assert.Equal(t, "going down 70%", b.string()) assert.Equal(t, "going down 70", b.string())
} }
func TestBatteryBackgroundColor(t *testing.T) { func TestBatteryBackgroundColor(t *testing.T) {