forked from onivim/oni2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEditorFontValidTest.re
43 lines (39 loc) · 1.35 KB
/
EditorFontValidTest.re
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
open Oni_Model;
open Oni_IntegrationTestLib;
let fontToUse =
switch (Revery.Environment.os) {
| Revery.Environment.Windows(_) => "Consolas"
| Revery.Environment.Mac(_) => "Menlo"
| Revery.Environment.Linux(_) => "Ubuntu Mono"
| _ => "Courier"
};
// Try loading a different font
let configuration = {|{ "editor.fontFamily": "|} ++ fontToUse ++ {|"}|};
if (!Revery.Environment.isLinux) {
// Skipping this test on Linux, because there is a known fontconfig memory leak we hit.
// The `FcInit` function in fontconfig leaks, and calling `FcFini` to clean it up crashes.
// Some related notes:
// https://www.spinics.net/lists/font-config/msg04332.html
// https://bugs.archlinux.org/task/64168
runTest(
~configuration=Some(configuration),
~name="EditorFontValid",
({wait, _}) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Selectors.mode(state) |> Vim.Mode.isNormal
);
wait(
~name="There should be a new font set",
~timeout=10.,
(state: State.t) => {
let fontName =
state.editorFont.fontFamily
|> Revery_Font.Family.toSkia(Revery.Font.Weight.Normal)
|> Option.map(tf => Skia.Typeface.getFamilyName(tf))
|> Option.value(~default="");
!String.equal(fontName, "JetBrains Mono");
},
);
},
);
};