File: accel_test.go

package info (click to toggle)
golang-github-gotk3-gotk3 0.6.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,392 kB
  • sloc: ansic: 914; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 717 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Same copyright and license as the rest of the files in this project

package gtk

import "testing"

func Test_AccelGroup_Locking(t *testing.T) {
	ag, _ := AccelGroupNew()
	if ag.IsLocked() {
		t.Error("A newly created AccelGroup should not be locked")
	}

	ag.Lock()

	if !ag.IsLocked() {
		t.Error("A locked AccelGroup should report being locked")
	}

	ag.Unlock()

	if ag.IsLocked() {
		t.Error("An unlocked AccelGroup should report being unlocked")
	}
}

func Test_AcceleratorParse(t *testing.T) {
	l, r := AcceleratorParse("<Shift><Alt>F1")
	if l != 65470 {
		t.Errorf("Expected parsed key to equal %d but was %d", 65470, l)
	}
	if r != 9 {
		t.Errorf("Expected parsed mods to equal %d but was %d", 9, r)
	}
}