-
-
Save MasterQ32/087ca5ce9d6cfe47d776f06849f9a0aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test "Widget Bindings" { | |
const allocator = std.heap.direct_allocator; | |
var obj = Object.init(allocator, ObjectID.init(1)); | |
defer obj.deinit(); | |
var widget = Widget.init(allocator); | |
defer widget.deinit(); | |
const pid = PropertyID.init(42); | |
try obj.setProperty(pid, Value{ .integer = 100 }); | |
widget.properties.left = 10; | |
std.testing.expectEqual(@as(i32, 10), try widget.get(.left)); | |
widget.bindingSource = &obj; | |
widget.bindings.left = pid; | |
std.testing.expectEqual(@as(i32, 100), try widget.get(.left)); | |
try widget.set(.left, 50); | |
std.testing.expectEqual(@as(i32, 50), obj.getProperty(pid).?.integer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment