]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/testipp.c
Update svn:keyword properties.
[thirdparty/cups.git] / cups / testipp.c
index 70c83bf4b5e36079b712b16a93a803dbda6d4e72..a0f6a686f2a990c1b204f9240b994ddb5f608c27 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * "$Id: testipp.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id$"
  *
  *   IPP test program for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2005 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -263,6 +263,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
   cups_file_t  *fp;            /* File pointer */
   int          i;              /* Looping var */
   int          status;         /* Status of tests (0 = success, 1 = fail) */
+  const char   *name;          /* Option name */
 
 
   status = 0;
@@ -278,7 +279,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
     request = ippNew();
     request->request.op.version[0]   = 0x01;
     request->request.op.version[1]   = 0x01;
-    request->request.op.operation_id = IPP_PRINT_JOB;
+    request->request.op.operation_id = IPP_OP_PRINT_JOB;
     request->request.op.request_id   = 1;
 
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
@@ -336,11 +337,11 @@ main(int  argc,                   /* I - Number of command-line arguments */
     data.wbuffer = buffer;
 
     while ((state = ippWriteIO(&data, (ipp_iocb_t)write_cb, 1, NULL,
-                               request)) != IPP_DATA)
-      if (state == IPP_ERROR)
+                               request)) != IPP_STATE_DATA)
+      if (state == IPP_STATE_ERROR)
        break;
 
-    if (state != IPP_DATA)
+    if (state != IPP_STATE_DATA)
     {
       printf("FAIL - %d bytes written.\n", (int)data.wused);
       status = 1;
@@ -379,13 +380,13 @@ main(int  argc,                   /* I - Number of command-line arguments */
     data.rpos = 0;
 
     while ((state = ippReadIO(&data, (ipp_iocb_t)read_cb, 1, NULL,
-                              request)) != IPP_DATA)
-      if (state == IPP_ERROR)
+                              request)) != IPP_STATE_DATA)
+      if (state == IPP_STATE_ERROR)
        break;
 
     length = ippLength(request);
 
-    if (state != IPP_DATA)
+    if (state != IPP_STATE_DATA)
     {
       printf("FAIL - %d bytes read.\n", (int)data.rpos);
       status = 1;
@@ -563,13 +564,13 @@ main(int  argc,                   /* I - Number of command-line arguments */
     data.wbuffer = mixed;
 
     while ((state = ippReadIO(&data, (ipp_iocb_t)read_cb, 1, NULL,
-                              request)) != IPP_DATA)
-      if (state == IPP_ERROR)
+                              request)) != IPP_STATE_DATA)
+      if (state == IPP_STATE_ERROR)
        break;
 
     length = ippLength(request);
 
-    if (state != IPP_DATA)
+    if (state != IPP_STATE_DATA)
     {
       printf("FAIL - %d bytes read.\n", (int)data.rpos);
       status = 1;
@@ -625,11 +626,26 @@ main(int  argc,                   /* I - Number of command-line arguments */
 
     ippDelete(request);
 
+#ifdef DEBUG
+   /*
+    * Test that private option array is sorted...
+    */
+
+    fputs("_ippCheckOptions: ", stdout);
+    if ((name = _ippCheckOptions()) == NULL)
+      puts("PASS");
+    else
+    {
+      printf("FAIL (\"%s\" out of order)\n", name);
+      status = 1;
+    }
+#endif /* DEBUG */
+
    /*
     * Test _ippFindOption() private API...
     */
 
-    fputs("_ippFindOption(printer-type): ", stdout);
+    fputs("_ippFindOption(\"printer-type\"): ", stdout);
     if (_ippFindOption("printer-type"))
       puts("PASS");
     else
@@ -666,9 +682,9 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
       request = ippNew();
       while ((state = ippReadIO(fp, (ipp_iocb_t)cupsFileRead, 1, NULL,
-                                request)) == IPP_ATTRIBUTE);
+                                request)) == IPP_STATE_ATTRIBUTE);
 
-      if (state != IPP_DATA)
+      if (state != IPP_STATE_DATA)
       {
        printf("Error reading IPP message from \"%s\"!\n", argv[i]);
        status = 1;
@@ -901,7 +917,7 @@ print_attributes(ipp_t *ipp,                /* I - IPP request */
       case IPP_TAG_RESOLUTION :
           for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
            printf(" %dx%d%s", val->resolution.xres, val->resolution.yres,
-                  val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpc");
+                  val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
           putchar('\n');
           break;
 
@@ -1001,5 +1017,5 @@ write_cb(_ippdata_t   *data,              /* I - Data */
 
 
 /*
- * End of "$Id: testipp.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id$".
  */