]> gitweb.factorcode.org Git - factor.git/blob - core/ui/cocoa/test/cocoa.factor
a169496589804d3ad8274bcd6ee914432b79fdce
[factor.git] / core / ui / cocoa / test / cocoa.factor
1 IN: objc-classes
2 DEFER: Foo
3 DEFER: Bar
4
5 IN: temporary
6 USING: cocoa compiler kernel objc namespaces objc-classes test memory ;
7
8 "NSObject" "Foo"
9 { { "foo:" "void" { "id" "SEL" "NSRect" } [ full-gc "x" set 2drop ] } }
10 define-objc-class
11
12 : test-foo
13     Foo -> alloc -> init
14     dup 1.0 2.0 101.0 102.0 <NSRect> -> foo:
15     -> release ;
16
17 test-foo
18
19 [ 1 ] [ "x" get NSRect-x ] unit-test
20 [ 2 ] [ "x" get NSRect-y ] unit-test
21 [ 101 ] [ "x" get NSRect-w ] unit-test
22 [ 102 ] [ "x" get NSRect-h ] unit-test
23
24 "NSObject" "Bar"
25 { { "bar" "NSRect" { "id" "SEL" } [ 2drop test-foo "x" get ] } }
26 define-objc-class
27
28 Bar [
29     -> alloc -> init
30     dup -> bar "x" set
31     -> release
32 ] compile-1
33
34 [ 1 ] [ "x" get NSRect-x ] unit-test
35 [ 2 ] [ "x" get NSRect-y ] unit-test
36 [ 101 ] [ "x" get NSRect-w ] unit-test
37 [ 102 ] [ "x" get NSRect-h ] unit-test