Fix failing test

This commit is contained in:
Kovid Goyal 2023-01-02 07:42:25 +05:30
parent 1fa1a478d9
commit 73a055fe12
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -40,7 +40,7 @@ func TestGraphicsCommandSerialization(t *testing.T) {
data := c.AsAPC([]byte(payload))
encoded := strings.Builder{}
compressed := false
var data_size uint64
is_first := true
for {
idx := strings.Index(data, "\033_")
if idx < 0 {
@ -50,9 +50,9 @@ func TestGraphicsCommandSerialization(t *testing.T) {
apc := data[idx+2 : l]
data = data[l+2:]
g := GraphicsCommandFromAPC([]byte(apc))
if data_size == 0 {
data_size = g.DataSize()
if is_first {
compressed = g.Compression() != 0
is_first = false
}
encoded.WriteString(g.ResponseMessage())
if g.m == GRT_more_nomore {
@ -66,9 +66,6 @@ func TestGraphicsCommandSerialization(t *testing.T) {
if err != nil {
t.Fatalf("Encoded data not valid base-64 with error: %v", err)
}
if data_size > 0 && uint64(len(decoded)) != data_size {
t.Fatalf("Data size %d != decoded size %d", data_size, len(decoded))
}
if compressed {
b := bytes.Buffer{}
b.Write(decoded)