go-hep.org/x/hep@v0.38.1/groot/rpad/canvas_test.go (about) 1 // Copyright ©2023 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package rpad_test 6 7 import ( 8 "testing" 9 10 "go-hep.org/x/hep/groot" 11 "go-hep.org/x/hep/groot/rpad" 12 "go-hep.org/x/hep/groot/rvers" 13 ) 14 15 func TestCanvasRead(t *testing.T) { 16 f, err := groot.Open("../testdata/tcanvas.root") 17 if err != nil { 18 t.Fatal(err) 19 } 20 defer f.Close() 21 22 o, err := f.Get("c1") 23 if err != nil { 24 t.Fatal(err) 25 } 26 c := o.(*rpad.Canvas) 27 28 if got, want := c.Name(), "c1"; got != want { 29 t.Fatalf("invalid name: got=%q, want=%q", got, want) 30 } 31 32 if got, want := c.Title(), "c1-title"; got != want { 33 t.Fatalf("invalid title: got=%q, want=%q", got, want) 34 } 35 36 if got, want := c.Class(), "TCanvas"; got != want { 37 t.Fatalf("invalid class: got=%q, want=%q", got, want) 38 } 39 40 if got, want := int(c.RVersion()), rvers.Canvas; got != want { 41 t.Fatalf("invalid version: got=%d, want=%d", got, want) 42 } 43 }