From: msweet Date: Fri, 7 Aug 2015 13:22:27 +0000 (+0000) Subject: Implement Identify-Printer and add tests. X-Git-Tag: v2.2b1~211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fd8cbfadb3d2328b99bcf3a058d3276bba9a623;p=thirdparty%2Fcups.git Implement Identify-Printer and add tests. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12839 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/test/identify-printer-display.test b/test/identify-printer-display.test new file mode 100644 index 0000000000..4957a26370 --- /dev/null +++ b/test/identify-printer-display.test @@ -0,0 +1,21 @@ +# Make the printer display a message +{ + # The name of the test... + NAME "Identify Printer with Message" + + # The operation to use + OPERATION Identify-Printer + + # Attributes, starting in the operation group... + 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 identify-actions display + ATTR text message "Hello\, World!" + + # What statuses are OK? + STATUS successful-ok + STATUS successful-ok-ignored-or-substituted-attributes +} diff --git a/test/identify-printer-multiple.test b/test/identify-printer-multiple.test new file mode 100644 index 0000000000..79b2580cec --- /dev/null +++ b/test/identify-printer-multiple.test @@ -0,0 +1,21 @@ +# Make the printer display a message and beep +{ + # The name of the test... + NAME "Identify Printer with Message and Beep" + + # The operation to use + OPERATION Identify-Printer + + # Attributes, starting in the operation group... + 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 identify-actions sound,display + ATTR text message "Hello\, World!" + + # What statuses are OK? + STATUS successful-ok + STATUS successful-ok-ignored-or-substituted-attributes +} diff --git a/test/ippserver.c b/test/ippserver.c index c7dbf042e9..cac45ecdcf 100644 --- a/test/ippserver.c +++ b/test/ippserver.c @@ -3726,7 +3726,21 @@ static void ipp_identify_printer( _ipp_client_t *client) /* I - Client */ { - /* TODO: Do something */ + ipp_attribute_t *actions, /* identify-actions */ + *message; /* message */ + + + actions = ippFindAttribute(client->request, "identify-actions", IPP_TAG_KEYWORD); + message = ippFindAttribute(client->request, "message", IPP_TAG_TEXT); + + if (!actions || ippContainsString(actions, "sound")) + { + putchar(0x07); + fflush(stdout); + } + + if (ippContainsString(actions, "display")) + printf("IDENTIFY from %s: %s\n", client->hostname, message ? ippGetString(message, 0, NULL) : "No message supplied"); respond_ipp(client, IPP_STATUS_OK, NULL); }