]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
ipptool's WITH-VALUE did not support rangeOfInteger attributes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 26 Oct 2010 22:38:55 +0000 (22:38 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 26 Oct 2010 22:38:55 +0000 (22:38 +0000)
Update get-printer-attributes test to use "real" names.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@9342 7a7537e8-13f0-0310-91df-b6672ffda945

test/get-printer-attributes.test
test/ipptool.c

index 54ce778b29fefc59882ccf9c9f660d0bd230927b..5940017a02640b0303bceaa8b499cb594b781f4b 100644 (file)
@@ -1,16 +1,13 @@
 # Get printer attributes using get-printer-attributes
 {
        # The name of the test...
-       NAME "Get printer attributes using get-printer-attributes"
-
-       # The resource to use for the POST
-       # RESOURCE /admin
+       NAME "Get printer attributes using Get-Printer-Attributes"
 
        # The operation to use
-       OPERATION get-printer-attributes
+       OPERATION Get-Printer-Attributes
 
        # Attributes, starting in the operation group...
-       GROUP operation
+       GROUP operation-attributes-tag
        ATTR charset attributes-charset utf-8
        ATTR language attributes-natural-language en
        ATTR uri printer-uri $uri
index 81bef335c4cdb1f71afc819330e509771ec4fe70..6832f9d34931a104e8c1a53d2285478d15dc4b83 100644 (file)
@@ -4570,6 +4570,65 @@ with_value(char            *value,       /* I - Value string */
        }
        break;
 
+    case IPP_TAG_RANGE :
+        for (i = 0; i < attr->num_values; i ++)
+        {
+         char  op,                     /* Comparison operator */
+               *nextptr;               /* Next pointer */
+         int   intvalue;               /* Integer value */
+
+
+          valptr = value;
+         if (!strncmp(valptr, "no-value,", 9))
+           valptr += 9;
+
+         while (isspace(*valptr & 255) || isdigit(*valptr & 255) ||
+                *valptr == '-' || *valptr == ',' || *valptr == '<' ||
+                *valptr == '=' || *valptr == '>')
+         {
+           op = '=';
+           while (*valptr && !isdigit(*valptr & 255) && *valptr != '-')
+           {
+             if (*valptr == '<' || *valptr == '>' || *valptr == '=')
+               op = *valptr;
+             valptr ++;
+           }
+
+            if (!*valptr)
+             break;
+
+           intvalue = strtol(valptr, &nextptr, 0);
+           if (nextptr == valptr)
+             break;
+           valptr = nextptr;
+
+           switch (op)
+           {
+             case '=' :
+                 if (attr->values[i].range.upper == intvalue)
+                   return (1);
+                 break;
+             case '<' :
+                 if (attr->values[i].range.upper < intvalue)
+                   return (1);
+                 break;
+             case '>' :
+                 if (attr->values[i].range.upper > intvalue)
+                   return (1);
+                 break;
+           }
+         }
+        }
+
+       if (report)
+       {
+         for (i = 0; i < attr->num_values; i ++)
+           print_test_error("GOT: %s=%d-%d", attr->name,
+                            attr->values[i].range.lower,
+                            attr->values[i].range.upper);
+       }
+       break;
+
     case IPP_TAG_BOOLEAN :
        for (i = 0; i < attr->num_values; i ++)
        {