Skip to content

Commit

Permalink
pws: Fix formatting & unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrec committed Dec 1, 2020
1 parent 19e1f34 commit ef9702b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pws/format.go
Expand Up @@ -135,7 +135,7 @@ type Preview struct {
Resolution uint32
Height uint32 // Image height
_ [4]uint32

// little-endian 16bit colors, RGB 565 encoded.
imageData []byte
}
Expand Down
8 changes: 6 additions & 2 deletions pws/format_test.go
Expand Up @@ -53,9 +53,13 @@ var (
},
})

emptyRawHeader = []byte{0x41, 0x4e, 0x59, 0x43, 0x55, 0x42, 0x49, 0x43, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x90, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xac, 0x26, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x27, 0x1, 0x0, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfa, 0x44, 0xcd, 0xcc, 0x4c, 0x3d, 0x0, 0x0, 0x84, 0x41, 0x0, 0x0, 0x10, 0x40, 0x0, 0x0, 0x84, 0x41, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0xb0, 0x40, 0x0, 0x0, 0x0, 0x40, 0x55, 0x55, 0x55, 0x40, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0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0x0, 0x4, 0x0, 0x0, 0x0, 0x50, 0x27, 0x1, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb0, 0x40, 0x0, 0x0, 0xf0, 0x42, 0x0, 0x0, 0x84, 0x41, 0xcd, 0xcc, 0x4c, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x52, 0x27, 0x1, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb0, 0x40, 0x0, 0x0, 0xf0, 0x42, 0x0, 0x0, 0x84, 0x41, 0xcd, 0xcc, 0x4c, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x54, 0x27, 0x1, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb0, 0x40, 0x0, 0x0, 0xf0, 0x42, 0x0, 0x0, 0x84, 0x41, 0xcd, 0xcc, 0x4c, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x56, 0x27, 0x1, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb0, 0x40, 0x0, 0x0, 0xf0, 0x42, 0x0, 0x0, 0x84, 0x41, 0xcd, 0xcc, 0x4c, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7d, 0x4b, 0x7d, 0x4b, 0x7d, 0x4b, 0x7d, 0x4b}

emptyRaw = append(append(emptyRawHeader, emptyRawPreview...), emptyRawFooter...)
)
Expand Down

0 comments on commit ef9702b

Please sign in to comment.