forked from joejulian/gio
29cea1db49
Pointer hit areas and paint clip areas are separate concepts, but similar enough to warrant merging. This change replaces pointer hit areas with clip areas, so Gio is left with just one area concept (in package op/clip). The reason for separating the concepts in the original Gio release was because of my being unsure general path/stroke hit areas would ever be implemented, let alone efficient. This change represents a change of mind, in the sense that it's better to have an incomplete API than two separate area concepts. Leave the deprecated pointer.Rect, pointer.Ellipse for temporary backwards compatibility. This is an API change. Most existing programs should continue to build with this change, but may have to adjust to having all clip.Ops participate in InputOp hit areas. Signed-off-by: Elias Naur <mail@eliasnaur.com>
34 lines
675 B
Go
34 lines
675 B
Go
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
package pointer
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestTypeString(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
typ Type
|
|
res string
|
|
}{
|
|
{Cancel, "Cancel"},
|
|
{Press, "Press"},
|
|
{Release, "Release"},
|
|
{Move, "Move"},
|
|
{Drag, "Drag"},
|
|
{Enter, "Enter"},
|
|
{Leave, "Leave"},
|
|
{Scroll, "Scroll"},
|
|
{Enter | Leave, "Enter|Leave"},
|
|
{Press | Release, "Press|Release"},
|
|
{Enter | Leave | Press | Release, "Press|Release|Enter|Leave"},
|
|
{Move | Scroll, "Move|Scroll"},
|
|
} {
|
|
t.Run(tc.res, func(t *testing.T) {
|
|
if want, got := tc.res, tc.typ.String(); want != got {
|
|
t.Errorf("got %q; want %q", got, want)
|
|
}
|
|
})
|
|
}
|
|
}
|