gioui.org@v0.6.1-0.20240506124620-7a9ce51988ce/io/pointer/pointer_test.go (about)

     1  // SPDX-License-Identifier: Unlicense OR MIT
     2  
     3  package pointer
     4  
     5  import (
     6  	"testing"
     7  )
     8  
     9  func TestTypeString(t *testing.T) {
    10  	for _, tc := range []struct {
    11  		typ Kind
    12  		res string
    13  	}{
    14  		{Cancel, "Cancel"},
    15  		{Press, "Press"},
    16  		{Release, "Release"},
    17  		{Move, "Move"},
    18  		{Drag, "Drag"},
    19  		{Enter, "Enter"},
    20  		{Leave, "Leave"},
    21  		{Scroll, "Scroll"},
    22  		{Enter | Leave, "Enter|Leave"},
    23  		{Press | Release, "Press|Release"},
    24  		{Enter | Leave | Press | Release, "Press|Release|Enter|Leave"},
    25  		{Move | Scroll, "Move|Scroll"},
    26  	} {
    27  		t.Run(tc.res, func(t *testing.T) {
    28  			if want, got := tc.res, tc.typ.String(); want != got {
    29  				t.Errorf("got %q; want %q", got, want)
    30  			}
    31  		})
    32  	}
    33  }