use base "installedtest"; use strict; use testapi; use utils; # This script checks # - the on-screen keyboard # - sticky keys # - slow keys # - repeating keys sub clean_entry { # This subroutine cleans the text entry. send_key('ctrl-a'); sleep(1); send_key('delete'); sleep(1); } # This helps to navigate to various switches, as the # GUI does not respond correctly when we click onto # the headline. A since all radio buttons look the # same, it is impossible to navigate through clicking # nor with 'send key until needlematch'. # Therefore, let's click into the text field and then # send a certain number of tabs to arrive at the correct # radio button. sub navigate_and_switch { my $tabs = shift; assert_and_click('acc_typing_text_entry'); foreach (1 .. $tabs) { send_key('tab'); sleep(1); } send_key("spc"); sleep(1); } sub run { my $self = shift; my $version = get_release_number(); # Screen Keyboard #################### # Select the Typing tab. assert_and_click('acc_typing_select_typing'); # Click on Screen Keyboard. assert_and_click('acc_typing_screen_keyboard'); # Click into the text entry. assert_and_click('acc_typing_text_entry'); # The screen keyboard should be visible by now, # so when we start clicking we should be fine. # Note, that we also test the keyboard elsewhere # so we only need to do some minor actions. # # Clicktype 'fed' my @letters = qw( f e d ); foreach my $letter (@letters) { assert_and_click("acc_keyboard_$letter"); } # Check that clicking on a suggestion will complete # the word in the entry field. assert_and_click('acc_typing_suggestion_fedora'); assert_screen('acc_typing_fedora_typed'); # Switch off screen_keyboard assert_and_click('acc_typing_screen_keyboard'); # Sticky keys ####################################### # Switch on Sticky keys. navigate_and_switch(4); # Send ctrl, alt, and the right arrow one after another. # With Sticky keys on, this should produce the key combo # to switch a workspace. send_key('ctrl'); send_key('alt'); send_key('right'); # Check that new workspace is shown assert_screen("${version}_background"); # Send ctrl, alt, and the left arrow one after another send_key('ctrl'); send_key('alt'); send_key('left'); # Check that we are back on workspace 1 assert_screen("acc_typing_text_entry"); # Switch off the Sticky keys again. navigate_and_switch(4); # Slow keys ######################################### # # Go to the text field and clean it. assert_and_click('acc_typing_text_entry'); clean_entry(); # With certain speed of typing, we should # be able to get all the letters typed # with the current settings. Let's do it. type_string("I love Fedora", max_interval => 140, secret => 0); # Check that we have that string assert_screen('acc_typing_slow_typed'); clean_entry(); # Now, switch on Slow keys. navigate_and_switch(6); # The standard selected time to wait in between key presses # is too long and it is difficult to select the correct # speed of typing -> usually we are too quick, so no # characters appear at all. Therefore, we need to shorten # the wait time. assert_and_click("acc_typing_select_waittime"); # Now, let us type the same string at the same pace as we # already did. This time, some of the characters should not # be caught, because we type too quickly for the wait mechanism # and the process should result in an erroneous string. assert_and_click('acc_typing_text_entry'); type_string("I love Fedora", max_interval => 140, secret => 0); # However, if the text is still correct, we assume that the # settings did not change anything and we will die # with an error message. die("Slowing the keys might not have worked correctly") if check_screen("acc_typing_slow_typed"); # Switch slow keys off again. navigate_and_switch(6); # Repeat keys ######################################### # Repeating keys are switched on by default, # so let's test they really work. # Click into text_entry assert_and_click('acc_typing_text_entry'); clean_entry(); # Hold down the x key for two seconds and then release it. # Two seconds are long time enough to produce a long series # of x letter to fill in the entire text field. hold_key('x'); sleep(2); release_key('x'); assert_screen('acc_typing_multiple_typed'); clean_entry(); # Navigate to the repeat keys switch and toggle it. navigate_and_switch(2); # Click into text_entry again. assert_and_click('acc_typing_text_entry'); # Hold down the x key for two seconds and then release it, # this time only one letter should appear because repeating # the keys is not allowed. hold_key('x'); sleep(2); release_key('x'); # Check that the entry field only shows one single letter x. assert_screen('acc_typing_one_letter'); } sub test_flags { return {fatal => 0, always_rollback => 1}; } 1; # vim: set sw=4 et: