From b231f87417759e219b9d1a0ea535442241577eab Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 4 Jun 2021 13:51:24 -0700 Subject: [PATCH] desktop_printing: adjust for cups-pdf output filename change A recent cups-pdf build changed the default filename for files output by cups-pdf. We need to have the test look for the correct filename based on the cups-pdf version. Signed-off-by: Adam Williamson --- tests/desktop_printing.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/desktop_printing.pm b/tests/desktop_printing.pm index f130fe26..54422256 100644 --- a/tests/desktop_printing.pm +++ b/tests/desktop_printing.pm @@ -16,6 +16,12 @@ sub run { script_run "chmod 666 testfile.txt"; # Install the Cups-PDF package to use the Cups-PDF printer assert_script_run "dnf -y install cups-pdf", 180; + # FIXME: log version of cups-pdf and check it for output location + # this is only necessary as long as the test may run on cups-pdf + # 3.0.1-11 or lower, as soon as that's not true we can cut it + my $cpdfver = script_output 'rpm -q cups-pdf --queryformat "%{VERSION}-%{RELEASE}\n"'; + assert_script_run "dnf -y install rpmdevtools", 180; + my $cpdfvercmp = script_run "rpmdev-vercmp $cpdfver 3.0.1-11.5"; # Leave the root terminal and switch back to desktop. desktop_vt(); my $desktop = get_var("DESKTOP"); @@ -58,7 +64,15 @@ sub run { # Open the pdf file and check the print send_key "alt-f2"; wait_still_screen(stilltime=>5, similarity_level=>45); - type_safely "$viewer /home/test/Desktop/testfile.pdf\n"; + # output location is different for cups-pdf 3.0.1-12 or later (we + # checked this above) + if ($cpdfvercmp eq "12") { + # older cups-pdf + type_safely "$viewer /home/test/Desktop/testfile.pdf\n"; + } + else { + type_safely "$viewer /home/test/Desktop/testfile-job_1.pdf\n"; + } wait_still_screen(stilltime=>5, similarity_level=>45); # Resize the window, so that the size of the document fits the bigger space # and gets more readable.