(t *testing.T)
| 28 | } |
| 29 | |
| 30 | func TestBackgroundImage(t *testing.T) { |
| 31 | img, _, err := imagex.Open("test.png") |
| 32 | assert.NoError(t, err) |
| 33 | RunTest(t, "background-image", 1260, 200, func(pc *Context) { |
| 34 | pabg := colors.Uniform(colors.White) |
| 35 | st := styles.NewStyle() |
| 36 | st.Background = img |
| 37 | st.ComputeActualBackground(pabg) |
| 38 | st.ToDots() |
| 39 | |
| 40 | sz := st.BoxSpace().Size().Add(math32.Vec2(200, 100)) |
| 41 | |
| 42 | test := func(of styles.ObjectFits, pos math32.Vector2) { |
| 43 | st.ObjectFit = of |
| 44 | pc.DrawStandardBox(st, pos, sz, pabg) |
| 45 | } |
| 46 | |
| 47 | test(styles.FitFill, math32.Vec2(0, 0)) |
| 48 | test(styles.FitContain, math32.Vec2(220, 0)) |
| 49 | test(styles.FitCover, math32.Vec2(440, 0)) |
| 50 | test(styles.FitScaleDown, math32.Vec2(660, 0)) |
| 51 | test(styles.FitNone, math32.Vec2(880, 0)) |
| 52 | }) |
| 53 | } |
| 54 | |
| 55 | func TestObjectFit(t *testing.T) { |
| 56 | img, _, err := imagex.Open("test.png") |
nothing calls this directly
no test coverage detected