File: window_since_3_16_test.go

package info (click to toggle)
golang-github-gotk3-gotk3 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,332 kB
  • sloc: ansic: 904; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 885 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
// Same copyright and license as the rest of the files in this project

// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14

// Package gtk_test is a separate package for unit tests.
// Doing this actually utilizes the go build cache
// for package gtk when changing unit test code.
package gtk_test

import (
	"testing"

	"github.com/gotk3/gotk3/gtk"
)

func TestWindowGetSetTitlebar(t *testing.T) {
	win := createTestWindow(t)

	// Create test button, SetCanDefault is required for SetDefault to work
	expected, err := gtk.ButtonNew()
	if err != nil {
		t.Error("unexpected error:", err.Error())
	}
	win.SetTitlebar(expected)

	a, err := win.GetTitlebar()
	if err != nil {
		t.Error("unexpected cast failure:", err.Error())
	}
	actual := a.ToWidget()
	if expected.Native() != actual.Native() {
		t.Errorf("Expected '0x%x'; Got '0x%x'", expected.Native(), actual.Native())
	}
}