/*
- * "$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
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;
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,
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;
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;
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;
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
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;
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;
/*
- * End of "$Id: testipp.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id$".
*/