Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

test: prove omitted cursorType reset independently

超超超超超级喜欢你的达妮娅9e28652cfbc8
diff --git a/crates/compositor/src/cursor.rs b/crates/compositor/src/cursor.rs
index cc19ce0cc..de80c043a 100644
--- a/crates/compositor/src/cursor.rs
+++ b/crates/compositor/src/cursor.rs
@@ -315,8 +315,8 @@ mod tests {
r#"{"samples":[
{"timeMs":0,"cx":0.1,"cy":0.1,"cursorType":"pointer"},
{"timeMs":100,"cx":0.2,"cy":0.2,"cursorType":null},
- {"timeMs":200,"cx":0.3,"cy":0.3},
- {"timeMs":300,"cx":0.4,"cy":0.4,"cursorType":"pointer"}
+ {"timeMs":200,"cx":0.3,"cy":0.3,"cursorType":"pointer"},
+ {"timeMs":300,"cx":0.4,"cy":0.4}
]}"#,
)
.expect("write temp sidecar");
@@ -332,9 +332,13 @@ mod tests {
);
assert_eq!(
track.type_at(0.20),
+ Some("pointer"),
+ "pointer after null must hold until the omitted-key sample"
+ );
+ assert_eq!(
+ track.type_at(0.30),
Some("arrow"),
- "omitted cursorType must reset to arrow"
+ "omitted cursorType after pointer must reset to arrow independently"
);
- assert_eq!(track.type_at(0.30), Some("pointer"));
}
}
diff --git a/src/lib/cursor/cursorThemes.test.ts b/src/lib/cursor/cursorThemes.test.ts
index 53590323e..00d5933e3 100644
--- a/src/lib/cursor/cursorThemes.test.ts
+++ b/src/lib/cursor/cursorThemes.test.ts
@@ -9,8 +9,10 @@ import {
describe("themePickerPreviewAssets", () => {
it("hello-kitty-watermelon exposes distinct arrow and pointer", () => {
const theme = CURSOR_THEMES.find((t) => t.id === "hello-kitty-watermelon");
- expect(theme).toBeTruthy();
- const preview = themePickerPreviewAssets(theme ?? null);
+ if (!theme) {
+ throw new Error("hello-kitty-watermelon theme is missing from CURSOR_THEMES");
+ }
+ const preview = themePickerPreviewAssets(theme);
expect(preview.arrow.length).toBeGreaterThan(0);
expect(preview.pointer).toBeTruthy();
expect(preview.pointer).not.toBe(preview.arrow);