Skip to content

Commit

Permalink
test(clafrica): Fix problems while test automation (#70)
Browse files Browse the repository at this point in the history
- Fix problem of unexpected sandbox window closing
- Fix problem of keyboard layout
  • Loading branch information
pythonbrad committed Aug 20, 2023
1 parent 69cb1b5 commit bf2a00a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
18 changes: 9 additions & 9 deletions clafrica/data/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ name = "Test code"
description = "Test code for testing purpose."

[core]
buffer_size = 128
buffer_size = 64
auto_capitalize = true

[data]
af = "ɑ"
Af = "α"
u5 = { value = "û", alias = ["5u"]}
aff = "ɑɑ"
aff3 = "ɑ̄ɑ̄"
cc = { value = "ç", alias = ["ccced"]}
af = { value = "ɑ", alias = ["qf"] }
Af = { value = "α", alias = ["Qf"] }
u5 = { value = "û", alias = ["5u", "(u", "u("] }
aff = { value = "ɑɑ", alias = ["qff"] }
aff3 = { value = "ɑ̄ɑ̄", alias = ["qff\""] }
c_ = { value = "ç", alias = ["c_ced", "c8", "c8ced"]}
uu = "ʉ"
uu3 = "ʉ̄"
uuaf3 = "ʉ̄ɑ̄"
uu3 = { value = "ʉ̄", alias = ["uu\""] }
uuaf3 = { value = "ʉ̄ɑ̄", alias = ["uuqf\""] }
26 changes: 10 additions & 16 deletions clafrica/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,7 @@ mod tests {
input_field.height(12);
input_field.pack().layout();
root.geometry(200, 200, 0, 0);
rstk::tell_wish(
r#"
bind . <Leave> { destroy . };
chan configure stdout -encoding utf-8;
"#,
);
rstk::tell_wish("chan configure stdout -encoding utf-8;");
thread::sleep(Duration::from_secs(1));
input_field
}
Expand Down Expand Up @@ -227,13 +222,13 @@ mod tests {
input!(KeyB KeyB KeyB Escape, typing_speed_ms);
input!(KeyU Backspace KeyU KeyU Backspace KeyU, typing_speed_ms);
input!(
KeyC KeyC KeyC KeyE KeyD
KeyC Num8 KeyC KeyE KeyD
KeyU KeyU
KeyA KeyF CapsLock Num3 CapsLock, typing_speed_ms);
KeyA KeyF Num3, typing_speed_ms);
input!(
KeyA KeyF KeyA KeyF
KeyA KeyF KeyF CapsLock Num3 CapsLock, typing_speed_ms);
input!(KeyU KeyU CapsLock Num3 CapsLock, typing_speed_ms);
KeyA KeyF KeyF Num3, typing_speed_ms);
input!(KeyU KeyU Num3, typing_speed_ms);
output!(textfield, format!("{LIMIT}uçʉ̄ɑ̄ɑɑɑ̄ɑ̄ʉ̄"));

// We verify that the undo (backspace) works as expected
Expand All @@ -244,21 +239,20 @@ mod tests {

// We verify that the pause/resume works as expected
input!(ControlLeft ControlLeft, typing_speed_ms);
input!(KeyA KeyF, typing_speed_ms);
input!(KeyU KeyU, typing_speed_ms);
input!(ControlLeft ControlRight, typing_speed_ms);
input!(KeyA KeyF, typing_speed_ms);
output!(textfield, format!("{LIMIT}afɑ"));
output!(textfield, format!("{LIMIT}uuɑ"));

(0..3).for_each(|_| {
input!(Backspace, typing_speed_ms);
});

// We verify the auto capitalization works as expected
input!(CapsLock KeyA CapsLock KeyF, typing_speed_ms);
input!(CapsLock KeyU CapsLock, typing_speed_ms);
input!(CapsLock Num5 CapsLock, typing_speed_ms);
input!(CapsLock Num5 CapsLock KeyU, typing_speed_ms);
output!(textfield, format!("{LIMIT}αÛû"));
input!(CapsLock KeyA CapsLock KeyF KeyF, typing_speed_ms);
input!(KeyA KeyF KeyF, typing_speed_ms);
output!(textfield, format!("{LIMIT}αⱭⱭɑɑ"));

rstk::end_wish();
}
Expand Down

0 comments on commit bf2a00a

Please sign in to comment.