From: Michael R Sweet Date: Wed, 7 Apr 2021 23:24:32 +0000 (-0400) Subject: Fix MONITOR-PRINTER-STATE directive. X-Git-Tag: v2.4b1~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bb4a5fd0a39fbc6d4359166fd88c4cfeb22190d;p=thirdparty%2Fcups.git Fix MONITOR-PRINTER-STATE directive. --- diff --git a/examples/Makefile b/examples/Makefile index 09cfa328d1..aade8e11f6 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,6 +1,7 @@ # # Example files makefile for CUPS. # +# Copyright © 2021 by OpenPrinting. # Copyright © 2007-2019 by Apple Inc. # Copyright © 2002-2005 by Easy Software Products. # @@ -87,6 +88,7 @@ TESTFILES = \ ipp-2.2.test \ ipp-backend.test \ ipp-everywhere.test \ + print-job.test \ print-job-and-wait.test \ print-job-deflate.test \ print-job-gzip.test \ @@ -94,8 +96,8 @@ TESTFILES = \ print-job-letter.test \ print-job-manual.test \ print-job-media-col.test \ + print-job-media-needed.test \ print-job-password.test \ - print-job.test \ print-uri.test \ set-attrs-hold.test \ validate-job.test diff --git a/examples/print-job-media-needed.test b/examples/print-job-media-needed.test new file mode 100644 index 0000000000..cc771745f6 --- /dev/null +++ b/examples/print-job-media-needed.test @@ -0,0 +1,49 @@ +# Print a test page, expecting the printer to run out of media +{ + PAUSE "Remove Paper" + + NAME "Print file expecting media-empty" + OPERATION Print-Job + GROUP operation-attributes-tag + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + ATTR mimeMediaType document-format $filetype + FILE $filename + STATUS successful-ok + + MONITOR-PRINTER-STATE $uri { + EXPECT printer-state-reasons WITH-VALUE "/^media-needed/" DEFINE-MATCH HAVE_MEDIA_NEEDED + } +} + +{ + PASS-IF-DEFINED HAVE_MEDIA_NEEDED + + NAME "Wait for media-empty" + OPERATION Get-Printer-Attributes + GROUP operation-attributes-tag + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + ATTR keyword requested-attributes printer-state-reasons + STATUS successful-ok + EXPECT printer-state-reasons WITH-VALUE "/^media-needed/" REPEAT-NO-MATCH +} + +{ + PAUSE "Load Paper" + + NAME "Wait for no media-empty" + OPERATION Get-Printer-Attributes + GROUP operation-attributes-tag + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + ATTR keyword requested-attributes printer-state-reasons + STATUS successful-ok + EXPECT printer-state-reasons WITH-VALUE "/^media-needed/" REPEAT-MATCH +} diff --git a/tools/ipptool.c b/tools/ipptool.c index 5cfdaab342..2162f7b1cf 100644 --- a/tools/ipptool.c +++ b/tools/ipptool.c @@ -2690,7 +2690,8 @@ parse_monitor_printer_state( if (strcmp(temp, "{")) { // Got a printer URI so copy it... - data->monitor_uri = strdup(temp); + _ippVarsExpand(data->vars, value, temp, sizeof(value)); + data->monitor_uri = strdup(value); // Then see if we have an opening brace... if (!_ippFileReadToken(f, temp, sizeof(temp)) || strcmp(temp, "{"))