Skip to content

Commit

Permalink
Add assert_screen_change
Browse files Browse the repository at this point in the history
Variant of wait_screen_change but dying on no screen change.
  • Loading branch information
okurz committed Jan 12, 2017
1 parent 6936e7f commit efc2234
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions testapi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ our @EXPORT = qw($realname $username $password $serialdev %cmd %vars
upload_asset upload_image data_url assert_shutdown parse_junit_log
upload_logs
wait_idle wait_screen_change wait_still_screen wait_serial record_soft_failure
wait_idle wait_screen_change assert_screen_change wait_still_screen wait_serial
record_soft_failure
become_root x11_start_program ensure_installed eject_cd power
save_memory_dump save_storage_drives freeze_vm resume_vm
Expand Down Expand Up @@ -353,7 +354,7 @@ sub assert_and_dclick {

=head2 wait_screen_change
wait_screen_change { CODEREF [,$timeout] };
wait_screen_change(CODEREF [,$timeout]);
Wrapper around code that is supposed to change the screen.
This is the opposite to C<wait_still_screen>. Make sure to put the commands to change the screen
Expand Down Expand Up @@ -396,6 +397,24 @@ sub wait_screen_change(&@) {
return 0;
}

=head2 assert_screen_change
assert_screen_change(CODEREF [,$timeout]);
Run C<CODEREF> with C<wait_screen_change> but C<die> if screen did not change
within timeout. Look into C<wait_screen_change> for details.
Example:
assert_screen_change { send_key 'alt-f4' };
=cut

sub assert_screen_change(&@) {
::wait_screen_change(@_) or die 'assert_screen_change failed to detect a screen change';
}


=head2 wait_still_screen
=for stopwords stilltime
Expand Down

0 comments on commit efc2234

Please sign in to comment.