Skip to content

Commit c35913a

Browse files
committed
Merge with master
2 parents aa66898 + 70e102e commit c35913a

File tree

80 files changed

+2727
-1910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2727
-1910
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,3 @@ jobs:
646646
needs: files-changed
647647
if: needs.files-changed.outputs.servo_example == 'true'
648648
uses: ./.github/workflows/servo_example.yaml
649-
secrets:
650-
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
651-
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}

.github/workflows/servo_example.yaml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ name: Servo example
66
on:
77
workflow_dispatch:
88
workflow_call:
9-
secrets:
10-
ANDROID_KEYSTORE_BASE64:
11-
required: true
12-
ANDROID_KEYSTORE_PASSWORD:
13-
required: true
149

1510
jobs:
1611
matrix_build:
@@ -36,12 +31,9 @@ jobs:
3631
working-directory: examples/servo
3732
run: cargo build --release
3833
android_build:
39-
runs-on: macos-latest
34+
runs-on: ubuntu-latest
4035
env:
4136
CARGO_INCREMENTAL: false
42-
CARGO_PROFILE_RELEASE_OPT_LEVEL: s
43-
CARGO_APK_RELEASE_KEYSTORE: /Users/runner/.android/release.keystore
44-
CARGO_APK_RELEASE_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
4537
steps:
4638
- uses: actions/checkout@v5
4739
# required for servo
@@ -55,17 +47,13 @@ jobs:
5547
uses: ./.github/actions/install-linux-dependencies
5648
- name: Install skia dependencies
5749
uses: ./.github/actions/install-skia-dependencies
58-
# required for anroid
50+
# required for android
5951
- name: Install API level
6052
run: ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-30"
6153
- name: Install cargo-apk
6254
run: cargo install cargo-apk
63-
- name: Decode keystore
64-
run: |
65-
mkdir -p /Users/runner/.android
66-
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > $CARGO_APK_RELEASE_KEYSTORE
6755
- name: Build
6856
working-directory: examples/servo
6957
run: |
70-
export BINDGEN_EXTRA_CLANG_ARGS="--target=aarch64-linux-android30 --sysroot=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/darwin-x86_64/sysroot"
71-
cargo apk build --target aarch64-linux-android --lib --release
58+
export BINDGEN_EXTRA_CLANG_ARGS="--target=aarch64-linux-android30 --sysroot=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/sysroot"
59+
cargo apk build --target aarch64-linux-android --lib

api/cpp/cbindgen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn builtin_structs(path: &Path) -> anyhow::Result<()> {
140140
$(#[non_exhaustive])?
141141
$(#[derive(Copy, Eq)])?
142142
struct $Name:ident {
143-
@name = $inner_name:literal
143+
@name = $inner_name:expr,
144144
export {
145145
$( $(#[doc = $pub_doc:literal])* $pub_field:ident : $pub_type:ty, )*
146146
}

api/node/__test__/api.spec.mts

Lines changed: 89 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright © SixtyFPS GmbH <[email protected]>
22
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
33

4-
import test from "ava";
4+
import { test, expect } from "vitest";
55
import * as path from "node:path";
66
import { fileURLToPath } from "node:url";
77

@@ -12,7 +12,7 @@ const dirname = path.dirname(
1212
);
1313

1414
// loadFile api
15-
test("loadFile", (t) => {
15+
test("loadFile", () => {
1616
// Test the URL variant here, to ensure that it works (esp. on Windows)
1717
const demo = loadFile(
1818
new URL(
@@ -21,30 +21,31 @@ test("loadFile", (t) => {
2121
),
2222
) as any;
2323
const test = new demo.Test();
24-
t.is(test.check, "Test");
24+
expect(test.check).toBe("Test");
2525

2626
const errorPath = path.join(dirname, "resources/error.slint");
2727

28-
const error = t.throws(
29-
() => {
30-
loadFile(errorPath);
31-
},
32-
{ instanceOf: CompileError },
33-
);
28+
let error: any;
29+
try {
30+
loadFile(errorPath);
31+
} catch (e) {
32+
error = e;
33+
}
34+
expect(error).toBeDefined();
35+
expect(error).toBeInstanceOf(CompileError);
3436

35-
const formattedDiagnostics = error?.diagnostics
37+
const formattedDiagnostics = error.diagnostics
3638
.map(
3739
(d) =>
3840
`[${d.fileName}:${d.lineNumber}:${d.columnNumber}] ${d.message}`,
3941
)
4042
.join("\n");
41-
t.is(
42-
error?.message,
43+
expect(error.message).toBe(
4344
"Could not compile " +
4445
errorPath +
4546
`\nDiagnostics:\n${formattedDiagnostics}`,
4647
);
47-
t.deepEqual(error?.diagnostics, [
48+
expect(error.diagnostics).toStrictEqual([
4849
{
4950
columnNumber: 18,
5051
level: 0,
@@ -70,7 +71,7 @@ test("loadFile", (t) => {
7071
]);
7172
});
7273

73-
test("loadFile constructor parameters", (t) => {
74+
test("loadFile constructor parameters", () => {
7475
const demo = loadFile(
7576
path.join(dirname, "resources/test-constructor.slint"),
7677
) as any;
@@ -84,64 +85,73 @@ test("loadFile constructor parameters", (t) => {
8485

8586
test.say_hello();
8687

87-
t.is(test.check, "test");
88-
t.is(hello, "hello");
88+
expect(test.check).toBe("test");
89+
expect(hello).toBe("hello");
8990
});
9091

91-
test("loadFile component instances and modules are sealed", (t) => {
92+
test("loadFile component instances and modules are sealed", () => {
9293
const demo = loadFile(path.join(dirname, "resources/test.slint")) as any;
9394

94-
t.throws(
95-
() => {
95+
{
96+
let thrownError: any;
97+
try {
9698
demo.no_such_property = 42;
97-
},
98-
{ instanceOf: TypeError },
99-
);
99+
} catch (error) {
100+
thrownError = error;
101+
}
102+
expect(thrownError).toBeDefined();
103+
expect(thrownError).toBeInstanceOf(TypeError);
104+
}
100105

101106
const test = new demo.Test();
102-
t.is(test.check, "Test");
107+
expect(test.check).toBe("Test");
103108

104-
t.throws(
105-
() => {
109+
{
110+
let thrownError: any;
111+
try {
106112
test.no_such_callback = () => {};
107-
},
108-
{ instanceOf: TypeError },
109-
);
113+
} catch (error) {
114+
thrownError = error;
115+
}
116+
expect(thrownError).toBeDefined();
117+
expect(thrownError).toBeInstanceOf(TypeError);
118+
}
110119
});
111120

112121
// loadSource api
113-
test("loadSource", (t) => {
122+
test("loadSource", () => {
114123
const source = `export component Test {
115124
out property <string> check: "Test";
116125
}`;
117126
const path = "api.spec.ts";
118127
const demo = loadSource(source, path) as any;
119128
const test = new demo.Test();
120-
t.is(test.check, "Test");
129+
expect(test.check).toBe("Test");
121130

122131
const errorSource = `export component Error {
123132
out property bool> check: "Test";
124133
}`;
125134

126-
const error = t.throws(
127-
() => {
128-
loadSource(errorSource, path);
129-
},
130-
{ instanceOf: CompileError },
131-
);
135+
let error: any;
136+
try {
137+
loadSource(errorSource, path);
138+
} catch (e) {
139+
error = e;
140+
}
141+
expect(error).toBeDefined();
142+
expect(error).toBeInstanceOf(CompileError);
132143

133-
const formattedDiagnostics = error?.diagnostics
144+
const formattedDiagnostics = error.diagnostics
134145
.map(
135146
(d) =>
136147
`[${d.fileName}:${d.lineNumber}:${d.columnNumber}] ${d.message}`,
137148
)
138149
.join("\n");
139-
t.is(
140-
error?.message,
150+
expect(error.message).toBe(
141151
"Could not compile " + path + `\nDiagnostics:\n${formattedDiagnostics}`,
142152
);
143153
// console.log(error?.diagnostics)
144-
t.deepEqual(error?.diagnostics, [
154+
expect(error.diagnostics).toStrictEqual([
145155
{
146156
columnNumber: 22,
147157
level: 0,
@@ -167,7 +177,7 @@ test("loadSource", (t) => {
167177
]);
168178
});
169179

170-
test("loadSource constructor parameters", (t) => {
180+
test("loadSource constructor parameters", () => {
171181
const source = `export component Test {
172182
callback say_hello();
173183
in-out property <string> check;
@@ -184,36 +194,44 @@ test("loadSource constructor parameters", (t) => {
184194

185195
test.say_hello();
186196

187-
t.is(test.check, "test");
188-
t.is(hello, "hello");
197+
expect(test.check).toBe("test");
198+
expect(hello).toBe("hello");
189199
});
190200

191-
test("loadSource component instances and modules are sealed", (t) => {
201+
test("loadSource component instances and modules are sealed", () => {
192202
const source = `export component Test {
193203
out property <string> check: "Test";
194204
}`;
195205
const path = "api.spec.ts";
196206
const demo = loadSource(source, path) as any;
197207

198-
t.throws(
199-
() => {
208+
{
209+
let thrownError: any;
210+
try {
200211
demo.no_such_property = 42;
201-
},
202-
{ instanceOf: TypeError },
203-
);
212+
} catch (error) {
213+
thrownError = error;
214+
}
215+
expect(thrownError).toBeDefined();
216+
expect(thrownError).toBeInstanceOf(TypeError);
217+
}
204218

205219
const test = new demo.Test();
206-
t.is(test.check, "Test");
220+
expect(test.check).toBe("Test");
207221

208-
t.throws(
209-
() => {
222+
{
223+
let thrownError: any;
224+
try {
210225
test.no_such_callback = () => {};
211-
},
212-
{ instanceOf: TypeError },
213-
);
226+
} catch (error) {
227+
thrownError = error;
228+
}
229+
expect(thrownError).toBeDefined();
230+
expect(thrownError).toBeInstanceOf(TypeError);
231+
}
214232
});
215233

216-
test("loadFile struct", (t) => {
234+
test("loadFile struct", () => {
217235
const demo = loadFile(
218236
path.join(dirname, "resources/test-struct.slint"),
219237
) as any;
@@ -222,10 +240,10 @@ test("loadFile struct", (t) => {
222240
check: new demo.TestStruct(),
223241
});
224242

225-
t.deepEqual(test.check, { text: "", flag: false, value: 0 });
243+
expect(test.check).toStrictEqual({ text: "", flag: false, value: 0 });
226244
});
227245

228-
test("loadFile struct constructor parameters", (t) => {
246+
test("loadFile struct constructor parameters", () => {
229247
const demo = loadFile(
230248
path.join(dirname, "resources/test-struct.slint"),
231249
) as any;
@@ -234,17 +252,21 @@ test("loadFile struct constructor parameters", (t) => {
234252
check: new demo.TestStruct({ text: "text", flag: true, value: 12 }),
235253
});
236254

237-
t.deepEqual(test.check, { text: "text", flag: true, value: 12 });
255+
expect(test.check).toStrictEqual({ text: "text", flag: true, value: 12 });
238256

239257
test.check = new demo.TestStruct({
240258
text: "hello world",
241259
flag: false,
242260
value: 8,
243261
});
244-
t.deepEqual(test.check, { text: "hello world", flag: false, value: 8 });
262+
expect(test.check).toStrictEqual({
263+
text: "hello world",
264+
flag: false,
265+
value: 8,
266+
});
245267
});
246268

247-
test("loadFile struct constructor more parameters", (t) => {
269+
test("loadFile struct constructor more parameters", () => {
248270
const demo = loadFile(
249271
path.join(dirname, "resources/test-struct.slint"),
250272
) as any;
@@ -258,10 +280,10 @@ test("loadFile struct constructor more parameters", (t) => {
258280
}),
259281
});
260282

261-
t.deepEqual(test.check, { text: "text", flag: true, value: 12 });
283+
expect(test.check).toStrictEqual({ text: "text", flag: true, value: 12 });
262284
});
263285

264-
test("loadFile enum", (t) => {
286+
test("loadFile enum", () => {
265287
const demo = loadFile(
266288
path.join(dirname, "resources/test-enum.slint"),
267289
) as any;
@@ -270,14 +292,14 @@ test("loadFile enum", (t) => {
270292
check: demo.TestEnum.b,
271293
});
272294

273-
t.deepEqual(test.check, "b");
295+
expect(test.check).toStrictEqual("b");
274296

275297
test.check = demo.TestEnum.c;
276298

277-
t.deepEqual(test.check, "c");
299+
expect(test.check).toStrictEqual("c");
278300
});
279301

280-
test("file loader", (t) => {
302+
test("file loader", () => {
281303
const testSource = `export component Test {
282304
in-out property <string> text: "Hello World";
283305
}`;
@@ -295,5 +317,5 @@ test("file loader", (t) => {
295317

296318
const test = new demo.App();
297319

298-
t.deepEqual(test.test_text, "Hello World");
320+
expect(test.test_text).toStrictEqual("Hello World");
299321
});

0 commit comments

Comments
 (0)