2022-01-25 13:45:38 +00:00
|
|
|
use base "installedtest";
|
|
|
|
use strict;
|
|
|
|
use testapi;
|
|
|
|
use utils;
|
|
|
|
|
|
|
|
# This part tests that we can create a new file that
|
|
|
|
# opens in a new panel, that we can add text, display
|
|
|
|
# text statistics and highlight code and save the file.
|
|
|
|
|
|
|
|
sub run {
|
|
|
|
my $self = shift;
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-01-25 13:45:38 +00:00
|
|
|
# First we will use key combo to open the new document window.
|
2022-07-15 18:15:52 +00:00
|
|
|
sleep 5;
|
2023-06-29 11:30:41 +00:00
|
|
|
# Click into the text to regain focus.
|
|
|
|
assert_and_click("gte_line_word");
|
2022-01-25 13:45:38 +00:00
|
|
|
send_key("ctrl-t");
|
|
|
|
assert_screen "gte_new_document_opened";
|
|
|
|
|
|
|
|
# Now let us produce some text
|
2022-08-22 21:27:50 +00:00
|
|
|
type_very_safely "# My shopping list.\n\n";
|
|
|
|
type_very_safely "* **Milk**\n* *Apples*\n* `Bananas`\n* Bread\n* Butter\n* Cheese\n\n";
|
|
|
|
type_very_safely "Happy shopping.";
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-01-25 13:45:38 +00:00
|
|
|
# Switch on Markdown Highlighting.
|
|
|
|
assert_and_click("gte_settings_button");
|
|
|
|
assert_and_click "gte_select_highlighting";
|
2022-09-20 14:19:58 +00:00
|
|
|
wait_still_screen(2);
|
2022-01-25 13:45:38 +00:00
|
|
|
type_very_safely "markdown";
|
|
|
|
send_key "ret";
|
|
|
|
assert_and_click("gte_window_dismiss");
|
|
|
|
assert_screen "gte_code_highlighted";
|
|
|
|
|
|
|
|
# Save the newly created file.
|
|
|
|
send_key("ctrl-s");
|
|
|
|
wait_still_screen(3);
|
2024-08-21 01:10:04 +00:00
|
|
|
|
|
|
|
if (check_screen "nautilus_save_filename") {
|
|
|
|
# if we hit the nautilus save-as screen, we have to select
|
|
|
|
# the right folder...
|
|
|
|
assert_and_click "nautilus_directory_documents";
|
|
|
|
# then click to edit the filename
|
|
|
|
assert_and_click "nautilus_save_filename";
|
|
|
|
}
|
2022-07-22 19:24:09 +00:00
|
|
|
# select the entire prefilled name (including extension) to overwrite it
|
|
|
|
send_key("ctrl-a");
|
|
|
|
wait_still_screen(3);
|
2022-01-25 13:45:38 +00:00
|
|
|
type_very_safely "list.md";
|
2024-08-20 23:52:51 +00:00
|
|
|
assert_and_click("gnome_button_save");
|
2022-09-20 14:19:58 +00:00
|
|
|
assert_screen("gte_file_saved");
|
2022-01-25 13:45:38 +00:00
|
|
|
# Check that the file has been created
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 3);
|
2022-09-20 14:19:58 +00:00
|
|
|
# The test started to fail on Silverblue
|
|
|
|
# because the target directory changed.
|
|
|
|
if (get_var("SUBVARIANT") eq "Silverblue") {
|
|
|
|
assert_script_run("ls /home/test/Documents/list.md");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
assert_script_run("ls /home/test/list.md");
|
|
|
|
}
|
2022-01-25 13:45:38 +00:00
|
|
|
desktop_vt();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub test_flags {
|
2023-07-05 18:39:18 +00:00
|
|
|
return {fatal => 1, milestone => 1};
|
2022-01-25 13:45:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|