waveshare2in13v2: List width first in String() result

The convention is to write dimensions with the width first.
pull/47/head
Michael Hanselmann 4 years ago committed by M-A
parent 59e1d3f851
commit 0349dabcd3

@ -281,7 +281,9 @@ func (d *Dev) Halt() error {
// String returns a string containing configuration information. // String returns a string containing configuration information.
func (d *Dev) String() string { func (d *Dev) String() string {
return fmt.Sprintf("epd.Dev{%s, %s, Height: %d, Width: %d}", d.c, d.dc, d.opts.Height, d.opts.Width) bounds := d.Bounds()
return fmt.Sprintf("epd.Dev{%s, %s, Width: %d, Height: %d}", d.c, d.dc, bounds.Dx(), bounds.Dy())
} }
// Sleep makes the controller enter deep sleep mode. It can be woken up by // Sleep makes the controller enter deep sleep mode. It can be woken up by

@ -25,14 +25,14 @@ func TestNew(t *testing.T) {
}{ }{
{ {
name: "empty", name: "empty",
wantString: "epd.Dev{playback, (0), Height: 0, Width: 0}", wantString: "epd.Dev{playback, (0), Width: 0, Height: 0}",
}, },
{ {
name: "EPD2in13v2", name: "EPD2in13v2",
opts: EPD2in13v2, opts: EPD2in13v2,
wantBounds: image.Rect(0, 0, 122, 250), wantBounds: image.Rect(0, 0, 122, 250),
wantBufferBounds: image.Rect(0, 0, 128, 250), wantBufferBounds: image.Rect(0, 0, 128, 250),
wantString: "epd.Dev{playback, (0), Height: 250, Width: 122}", wantString: "epd.Dev{playback, (0), Width: 122, Height: 250}",
}, },
} { } {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {

Loading…
Cancel
Save