/* LICENSE BEGIN This file is part of the SixtyFPS Project -- https://sixtyfps.io Copyright (c) 2021 Olivier Goffart Copyright (c) 2021 Simon Hausmann SPDX-License-Identifier: GPL-3.0-only This file is also available under commercial licensing terms. Please contact info@sixtyfps.io for more information. LICENSE END */ //include_path: ../../helper_components import { StyleMetrics } from "sixtyfps_widgets.60"; import { ExportedGlobal as ReexportedGlobal } from "export_globals.60"; struct MyStruct := { x:int, y: int, } global InternalGlobal := { property hello: 42; property my_struct; callback sum(int, int)->int; } export { InternalGlobal as PublicGlobal } export { ReexportedGlobal } TestCase := Rectangle { property test_global_prop_value: InternalGlobal.hello == 100; property test_call_callback: InternalGlobal.sum(6, 4); } /* ```rust let instance = TestCase::new(); assert!(!instance.get_test_global_prop_value()); assert_eq!(PublicGlobal::get(&instance).get_hello(), 42); instance.global::().set_hello(100); assert!(instance.get_test_global_prop_value()); assert_eq!(ReexportedGlobal::get(&instance).get_foo(), 44); instance.global::().on_sum(|a, b| a + b); assert_eq!(instance.get_test_call_callback(), 10); assert_eq!(instance.global::().invoke_sum(4, 5), 9); ``` ```cpp auto handle = TestCase::create(); const TestCase &instance = *handle; assert(!instance.get_test_global_prop_value()); assert_eq(instance.global().get_hello(), 42); instance.global().set_hello(100); assert(instance.get_test_global_prop_value()); assert_eq(instance.global().get_foo(), 44); instance.global().on_sum([](int a, int b) { return a + b; }); assert_eq(instance.get_test_call_callback(), 10); assert_eq(instance.global().invoke_sum(4, 5), 9); ``` ```js let instance = new sixtyfps.TestCase({}); assert(!instance.test_global_prop_value); // TODO ``` */