-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathstruct_test.go
More file actions
47 lines (40 loc) · 806 Bytes
/
Copy pathstruct_test.go
File metadata and controls
47 lines (40 loc) · 806 Bytes
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
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2013 The 'objc' Package Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package objc
import (
"testing"
)
type NSPoint struct {
X float32
Y float32
}
type NSSize struct {
Width float32
Height float32
}
type NSRect struct {
Origin NSPoint
Size NSSize
}
func TestStructPassing(t *testing.T) {
rect := NSRect{
NSPoint{
X: 0,
Y: 0,
},
NSSize{
Width: 500,
Height: 500,
},
}
obj := GetClass("NSValue").SendMsg("valueWithRect:", rect)
if obj.Pointer() == 0 {
t.Fatalf("unable to create NSWindow, got nil ptr")
}
want := "NSRect: {{0, 0}, {500, 500}}"
got := obj.String()
if got != want {
t.Fatalf("bad NSValue was constructed: got %v, want %v", got, want)
}
}