MCPcopy
hub / github.com/EngoEngine/engo / TestTMXTileImages

Function TestTMXTileImages

common/tmx_test.go:315–341  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

313}
314
315func TestTMXTileImages(t *testing.T) {
316 imgbuf := bytes.NewBuffer([]byte{})
317 img := image.NewRGBA(image.Rect(0, 0, 132, 99))
318 err := png.Encode(imgbuf, img)
319 if err != nil {
320 t.Errorf("Unable to encode png from image")
321 }
322
323 buf := bytes.NewBuffer([]byte{})
324 tmpl, err := template.New("test").Parse(testTMXtmpl)
325 if err != nil {
326 t.Error("Error parsing tmx template")
327 }
328 err = tmpl.Execute(buf, tmxData{
329 Orientation: "orthogonal",
330 RenderOrder: "left-up",
331 Tiles: true,
332 })
333 if err != nil {
334 t.Error("Error executing tmx template")
335 }
336
337 err = engo.Files.LoadReaderData("test.tmx", buf)
338 if err != nil {
339 t.Errorf("Unable to load tmx file for testing. Error was: %v", err)
340 }
341}
342
343func TestTMXTileImagesNotLoadedFileNotExist(t *testing.T) {
344 buf := bytes.NewBuffer([]byte{})

Callers

nothing calls this directly

Calls 3

LoadReaderDataMethod · 0.80
NewMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected