| 401 | */ |
| 402 | |
| 403 | static int /* O - 1 on failure, 0 on success */ |
| 404 | test_ppd_cache(_ppd_cache_t *pc, /* I - PWG mapping data */ |
| 405 | ppd_file_t *ppd) /* I - PPD file */ |
| 406 | { |
| 407 | int i, /* Looping var */ |
| 408 | status = 0; /* Return status */ |
| 409 | _ppd_cache_t *pc2; /* Loaded data */ |
| 410 | pwg_size_t *size, /* Size from original */ |
| 411 | *size2; /* Size from saved */ |
| 412 | pwg_map_t *map, /* Map from original */ |
| 413 | *map2; /* Map from saved */ |
| 414 | |
| 415 | |
| 416 | /* |
| 417 | * Verify that we can write and read back the same data... |
| 418 | */ |
| 419 | |
| 420 | fputs("_ppdCacheWriteFile(test.pwg): ", stdout); |
| 421 | if (!_ppdCacheWriteFile(pc, "test.pwg", NULL)) |
| 422 | { |
| 423 | puts("FAIL"); |
| 424 | status ++; |
| 425 | } |
| 426 | else |
| 427 | puts("PASS"); |
| 428 | |
| 429 | fputs("_ppdCacheCreateWithFile(test.pwg): ", stdout); |
| 430 | if ((pc2 = _ppdCacheCreateWithFile("test.pwg", NULL)) == NULL) |
| 431 | { |
| 432 | puts("FAIL"); |
| 433 | status ++; |
| 434 | } |
| 435 | else |
| 436 | { |
| 437 | // TODO: FINISH ADDING ALL VALUES IN STRUCTURE |
| 438 | if (pc2->num_sizes != pc->num_sizes) |
| 439 | { |
| 440 | if (!status) |
| 441 | puts("FAIL"); |
| 442 | |
| 443 | printf(" SAVED num_sizes=%d, ORIG num_sizes=%d\n", pc2->num_sizes, |
| 444 | pc->num_sizes); |
| 445 | |
| 446 | status ++; |
| 447 | } |
| 448 | else |
| 449 | { |
| 450 | for (i = pc->num_sizes, size = pc->sizes, size2 = pc2->sizes; |
| 451 | i > 0; |
| 452 | i --, size ++, size2 ++) |
| 453 | { |
| 454 | if (strcmp(size2->map.pwg, size->map.pwg) || |
| 455 | strcmp(size2->map.ppd, size->map.ppd) || |
| 456 | size2->width != size->width || |
| 457 | size2->length != size->length || |
| 458 | size2->left != size->left || |
| 459 | size2->bottom != size->bottom || |
| 460 | size2->right != size->right || |
no test coverage detected