ifd_builder: Added NewIfdBuilderWithExistingIfd test.

pull/3/head
Dustin Oprea 2018-04-23 22:07:13 -04:00
parent 1107496d3c
commit 098862d2f9
1 changed files with 25 additions and 1 deletions

View File

@ -1149,4 +1149,28 @@ func TestNewIfdBuilderFromExistingChain(t *testing.T) {
}
}
// TODO(dustin): !! Test with a GPS-attached image.
// TODO(dustin): !! Test with an actual GPS-attached image.
func TestNewIfdBuilderWithExistingIfd(t *testing.T) {
testIfdName := IfdGps
tagId := IfdTagIds[testIfdName]
ifd := &Ifd{
Name: testIfdName,
ByteOrder: binary.BigEndian,
Offset: 0x123,
}
ib := NewIfdBuilderWithExistingIfd(ifd)
if ib.ifdName != ifd.Name {
t.Fatalf("IFD-name not correct.")
} else if ib.ifdTagId != tagId {
t.Fatalf("IFD tag-ID not correct.")
} else if ib.byteOrder != ifd.ByteOrder {
t.Fatalf("IFD byte-order not correct.")
} else if ib.existingOffset != ifd.Offset {
t.Fatalf("IFD offset not correct.")
}
}