// Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 // Basic test for Platform.os and Platform.style-name. This is done in JS, as with Rust and C++ the style is fixed // to fluent. export global Info { out property style-name: Platform.style-name; } export component TestCase inherits Window { out property os: { if Platform.os == OperatingSystemType.android { "android" } else if Platform.os == OperatingSystemType.ios { "ios" } else if Platform.os == OperatingSystemType.macos { "macos" } else if Platform.os == OperatingSystemType.linux { "linux" } else if Platform.os == OperatingSystemType.windows { "windows" } else if Platform.os == OperatingSystemType.other { "other" } else { "error" } } out property style-name: Info.style-name; } /* ```js let instance = new slint.TestCase({}); let os = instance.os; let style_name = instance.style_name; console.log(style_name); const { platform } = require('node:process'); if (platform === 'win32') { assert.strictEqual(os, "windows"); assert.strictEqual(style_name, "fluent"); } else if (platform === 'darwin') { assert.strictEqual(os, "macos"); assert.strictEqual(style_name, "cupertino"); } else if (platform === 'linux') { assert.strictEqual(os, "linux"); assert(style_name == "qt" || style_name == "fluent"); } else { throw new Error("Unknown platform for this test: " + platform); } ``` */