icon_test.go raw

   1  // SPDX-License-Identifier: Unlicense OR MIT
   2  
   3  package widget
   4  
   5  import (
   6  	"image"
   7  	"image/color"
   8  	"testing"
   9  
  10  	"github.com/p9c/p9/pkg/gel/gio/layout"
  11  	"github.com/p9c/p9/pkg/gel/gio/op"
  12  	"github.com/p9c/p9/pkg/gel/gio/unit"
  13  	"golang.org/x/exp/shiny/materialdesign/icons"
  14  )
  15  
  16  func TestIcon_Alpha(t *testing.T) {
  17  	icon, err := NewIcon(icons.ToggleCheckBox)
  18  	if err != nil {
  19  		t.Fatal(err)
  20  	}
  21  
  22  	icon.Color = color.NRGBA{B: 0xff, A: 0x40}
  23  
  24  	gtx := layout.Context{
  25  		Ops:         new(op.Ops),
  26  		Constraints: layout.Exact(image.Pt(100, 100)),
  27  	}
  28  
  29  	_ = icon.Layout(gtx, unit.Sp(18))
  30  }
  31