1package vt
2
3import "testing"
4
5func TestGeometryValidityAndPixelsKnown(t *testing.T) {
6 tests := []struct {
7 name string
8 geometry Geometry
9 valid, hasPixel bool
10 }{
11 {name: "cells only", geometry: Geometry{Cols: 80, Rows: 24}, valid: true},
12 {name: "full", geometry: Geometry{Cols: 80, Rows: 24, PixelWidth: 640, PixelHeight: 384}, valid: true, hasPixel: true},
13 {name: "partial pixels are unknown", geometry: Geometry{Cols: 80, Rows: 24, PixelWidth: 640}, valid: true},
14 {name: "zero columns", geometry: Geometry{Rows: 24, PixelWidth: 640, PixelHeight: 384}, hasPixel: true},
15 }
16 for _, tt := range tests {
17 t.Run(tt.name, func(t *testing.T) {
18 if got := tt.geometry.Valid(); got != tt.valid {
19 t.Fatalf("Valid() = %t, want %t", got, tt.valid)
20 }
21 if got := tt.geometry.PixelsKnown(); got != tt.hasPixel {
22 t.Fatalf("PixelsKnown() = %t, want %t", got, tt.hasPixel)
23 }
24 })
25 }
26}