1
0
Fork 0

Adding upstream version 0.0~git20250520.a1d9079+dfsg.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-24 19:46:29 +02:00
parent 590ac7ff5f
commit 20149b7f3a
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
456 changed files with 70406 additions and 0 deletions

View file

@ -0,0 +1,72 @@
// Copyright 2016 The Go 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 objcpkg
import (
"ObjC/Foundation"
gopkg "ObjC/Objcpkg"
"ObjC/UIKit"
)
const (
DescriptionStr = "Descriptrion from Go"
Hash = 42
)
type GoNSDate struct {
Foundation.NSDate
}
func (d *GoNSDate) Hash(self gopkg.GoNSDate) int {
return Hash
}
func (d *GoNSDate) Description(self gopkg.GoNSDate) string {
// Test self call
if h := self.Hash(); h != Hash {
panic("hash mismatch")
}
return DescriptionStr
}
func (d *GoNSDate) GetSelf(self gopkg.GoNSDate) Foundation.NSDate {
return self
}
func NewGoNSDate() *GoNSDate {
return new(GoNSDate)
}
type GoNSObject struct {
C Foundation.NSObjectC // The class
P Foundation.NSObjectP // The protocol
UseSelf bool
}
func (o *GoNSObject) Description(self gopkg.GoNSObject) string {
if o.UseSelf {
return DescriptionStr
} else {
return self.Super().Description()
}
}
func DupNSDate(date Foundation.NSDate) Foundation.NSDate {
return date
}
type GoUIResponder struct {
UIKit.UIResponder
Called bool
}
func (r *GoUIResponder) PressesBegan(_ Foundation.NSSet, _ UIKit.UIPressesEvent) {
r.Called = true
}
// Check that implicitly referenced types are wrapped.
func implicitType(r UIKit.UIResponder) {
r.MotionBegan(0, nil)
}

47
bind/testdata/testpkg/objcpkg/objc.go vendored Normal file
View file

@ -0,0 +1,47 @@
// Copyright 2016 The Go 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 objcpkg
import (
"ObjC/Foundation/NSDate"
"ObjC/Foundation/NSString"
"ObjC/QuartzCore/CAMediaTimingFunction"
)
func Func() {
NSDate.Date()
CAMediaTimingFunction.FunctionWithControlPoints(0, 0, 0, 0)
}
func Method() string {
d := NSDate.Date()
return d.Description()
}
func New() {
NSDate.New()
CAMediaTimingFunction.NewWithControlPoints(0, 0, 0, 0)
}
func Error() {
str, err := NSString.StringWithContentsOfFileEncodingError("<non-existent>", 0)
if err == nil {
panic("no error from stringWithContentsOfFile")
}
// Assert err is an error
err = err.(error)
if str != "" {
panic("non-empty string from stringWithContentsOfFile")
}
str, err = NSString.NewWithContentsOfFileEncodingError("<non-existent>", 0)
if err == nil {
panic("no error from stringWithContentsOfFile")
}
// Assert err is an error
err = err.(error)
if str != "" {
panic("non-empty string from initWithContentsOfFile")
}
}