Skip to content

Commit

Permalink
Add test for issue nim-lang#19484
Browse files Browse the repository at this point in the history
  • Loading branch information
iacore committed Feb 3, 2022
1 parent 772ed5e commit de7a513
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/objects/rect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
typedef struct Rectangle {
float x,y,width,height;
} Rectangle;
29 changes: 29 additions & 0 deletions tests/objects/t19484.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from os import parentDir, `/`

type
Rectangle* {.importc: "Rectangle", header: currentSourcePath().parentDir()/"rect.h", bycopy.} = object
x* {.importc: "x".}: cfloat ## NmrlbNow_Rectangle top-left corner position x
y* {.importc: "y".}: cfloat ## NmrlbNow_Rectangle top-left corner position y
width* {.importc: "width".}: cfloat ## NmrlbNow_Rectangle width
height* {.importc: "height".}: cfloat ## NmrlbNow_Rectangle height

ValueType* = object
payload: int
Effect* = object

Node* = object
disabled: bool
shapepos: Rectangle
inputs: seq[ValueType]
outputs: seq[ValueType]
rails: seq[Effect]

var nodes: seq[Node]
var node: Node = default(Node)
let shapepos = Rectangle(x: 12.0, y: 34.0, width: 56.0, height: 78.0)
node.shapepos = shapepos
node.inputs.add ValueType(payload:42)
echo node
nodes.add node
echo nodes
doAssert nodes[0].shapepos.x == shapepos.x

0 comments on commit de7a513

Please sign in to comment.