File: actionable_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 (35 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (2)
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
35
package gtk

import "testing"

func TestActionableImplementsIActionable(t *testing.T) {
	var cut interface{}
	cut = &Actionable{}
	_, ok := cut.(IActionable)

	if !ok {
		t.Error("Actionable does not implement IActionable")
		return
	}
}

// TestGetSetActionName tests the getter and setter for action name
// using a button, as we need an actual instance implementing Actionable.
func TestGetSetActionName(t *testing.T) {
	cut, err := ButtonNew()
	if err != nil {
		t.Fatal("Error creating button", err.Error())
	}

	expected := "app.stuff"
	cut.SetActionName(expected)

	actual, err := cut.GetActionName()
	if err != nil {
		t.Fatal("Error getting action name", err.Error())
	}

	if expected != actual {
		t.Fatalf("Expected %s got %s", expected, actual)
	}
}