#
# PWG 5100.7-2023: IPP Job Extensions v2.1 (JOBEXT)
#
# https://ftp.pwg.org/pub/pwg/candidates/cs-ippjobext21-20230210-5100.7.pdf
#
# Copyright © 2018-2024 by OpenPrinting.
#
# Licensed under Apache License v2.0.  See the file "LICENSE" for more
# information.
#
# Usage:
#
#   ./ipptool [OPTIONS] -f FILENAME -t PRINTER-URI pwg5100.7.test
#
# Options:
#
#   -d NOPRINT=1              Disable the print tests.
#   -d REQUIRE_JOBEXT=1       Require support for the JOBEXT specification.
#

{
    NAME "PWG 5100.7-2023: Operations, Attributes, and Values"
    OPERATION Get-Printer-Attributes

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR language attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR keyword requested-attributes all,media-col-database

    STATUS successful-ok

    # Required operations
    EXPECT operations-supported OF-TYPE enum IN-GROUP printer-attributes-tag
    EXPECT operations-supported WITH-VALUE 0x0005 DEFINE-MATCH PRINTER_HAS_CREATE_JOB # Create-Job
	EXPECT operations-supported WITH-VALUE 0x003B IF-DEFINED PRINTER_HAS_CREATE_JOB IF-DEFINED REQUIRE_JOBEXT # Close-Job
    EXPECT operations-supported WITH-VALUE 0x0038 IF-DEFINED REQUIRE_JOBEXT # Cancel-Jobs
    EXPECT operations-supported WITH-VALUE 0x0039 IF-DEFINED REQUIRE_JOBEXT # Cancel-My-Jobs

    EXPECT operations-supported WITH-VALUE 0x0038 DEFINE-MATCH PRINTER_HAS_CANCEL_JOBS
    EXPECT operations-supported WITH-VALUE 0x0039 DEFINE-MATCH PRINTER_HAS_CANCEL_MY_JOBS
    EXPECT operations-supported WITH-VALUE 0x003A DEFINE-MATCH PRINTER_HAS_RESUBMIT_JOB
    EXPECT operations-supported WITH-VALUE 0x003B DEFINE-MATCH PRINTER_HAS_CLOSE_JOB

    # Attributes and values
    EXPECT job-creation-attributes-supported WITH-VALUE client-info DEFINE-MATCH PRINTER_HAS_CLIENT_INFO
    EXPECT client-info-supported IF-DEFINED PRINTER_HAS_CLIENT_INFO
    EXPECT ?client-info-supported OF-TYPE keyword IN-GROUP printer-attributes-tag

    EXPECT document-charset-supported DEFINE-MATCH PRINTER_HAS_DOCUMENT_CHARSET
    EXPECT document-charset-default OF-TYPE charset IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE-FROM document-charset-supported IF-DEFINED PRINTER_HAS_DOCUMENT_CHARSET
    EXPECT document-charset-supported OF-TYPE charset IN-GROUP printer-attributes-tag IF-DEFINED PRINTER_HAS_DOCUMENT_CHARSET

    EXPECT document-natural-language-supported DEFINE-MATCH PRINTER_HAS_DOCUMENT_NATURAL_LANGUAGE
    EXPECT document-natural-language-default OF-TYPE naturalLanguage IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE-FROM document-natural-language-supported IF-DEFINED PRINTER_HAS_DOCUMENT_NATURAL_LANGUAGE
    EXPECT document-natural-language-supported OF-TYPE naturalLanguage IN-GROUP printer-attributes-tag IF-DEFINED PRINTER_HAS_DOCUMENT_NATURAL_LANGUAGE

    EXPECT job-account-id-supported DEFINE-MATCH PRINTER_HAS_JOB_ACCOUNT_ID
    EXPECT job-account-id-default OF-TYPE name|no-value IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_ACCOUNT_ID
    EXPECT job-account-id-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_ACCOUNT_ID

    EXPECT job-accounting-user-id-supported DEFINE-MATCH PRINTER_HAS_JOB_ACCOUNTING_USER_ID
    EXPECT job-accounting-user-id-default OF-TYPE name|no-value IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_ACCOUNTING_USER_ID
    EXPECT job-accounting-user-id-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT  1 IF-DEFINED PRINTER_HAS_JOB_ACCOUNTING_USER_ID

    EXPECT job-cancel-after-supported DEFINE-MATCH PRINTER_HAS_JOB_CANCEL_AFTER
    EXPECT job-cancel-after-default OF-TYPE integer(0:MAX)|no-value IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_CANCEL-AFTER
    EXPECT job-cancel-after-supported OF-TYPE rangeOfInteger(0:MAX) IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_CANCEL-AFTER

    EXPECT job-creation-attributes-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?job-creation-attributes-supported OF-TYPE keyword IN-GROUP printer-attributes-tag

    EXPECT job-delay-output-until-supported DEFINE-MATCH PRINTER_HAS_JOB_DELAY_OUTPUT_UNTIL
    EXPECT job-delay-output-until-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE-FROM job-delay-output-until-supported IF-DEFINED PRINTER_HAS_JOB_DELAY_OUTPUT_UNTIL
    EXPECT job-delay-output-until-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag IF-DEFINED PRINTER_HAS_JOB_DELAY_OUTPUT_UNTIL
    EXPECT job-delay-output-until-time-supported OF-TYPE rangeOfInteger(0:MAX) IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_DELAY_OUTPUT_UNTIL

    EXPECT job-history-attributes-configured IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?job-history-attributes-configured OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-ALL-VALUES-FROM job-history-attributes-supported
    EXPECT job-history-attributes-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?job-history-attributes-supported OF-TYPE keyword IN-GROUP printer-attributes-tag

    EXPECT job-history-interval-configured IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?job-history-interval-configured OF-TYPE integer(0:MAX) IN-GROUP printer-attributes-tag COUNT 1
    EXPECT job-history-interval-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?job-history-interval-supported OF-TYPE rangeOfInteger(0:MAX) IN-GROUP printer-attributes-tag COUNT 1

    EXPECT job-hold-until-supported DEFINE-MATCH PRINTER_HAS_JOB_HOLD_UNTIL
    EXPECT job-hold-until-time-supported IF-DEFINED PRINTER_HAS_JOB_HOLD_UNTIL
    EXPECT ?job-hold-until-time-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1

    EXPECT job-ids-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED REQUIRE_JOBEXT

    EXPECT job-mandatory-attributes-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT  1 IF-DEFINED REQUIRE_JOBEXT

    EXPECT job-retain-until-supported DEFINE-MATCH PRINTER_HAS_JOB_RETAIN_UNTIL
    EXPECT job-retain-until-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE-FROM job-retain-until-supported IF-DEFINED PRINTER_HAS_JOB_RETAIN_UNTIL
    EXPECT job-retain-until-interval-default OF-TYPE integer(0:MAX)|no-value IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_RETAIN_UNTIL
    EXPECT job-retain-until-interval-supported OF-TYPE rangeOfInteger(0:MAX) IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_RETAIN_UNTIL
    EXPECT job-retain-until-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag IF-DEFINED PRINTER_HAS_JOB_RETAIN_UNTIL
    EXPECT job-retain-until-time-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_RETAIN_UNTIL

    EXPECT job-sheets-supported DEFINE-MATCH PRINTER_HAS_JOB_SHEETS
    EXPECT job-sheets-col-default OF-TYPE collection|no-value IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_JOB_SHEETS
    EXPECT job-sheets-col-supported OF-TYPE keyword IN-GROUP printer-attributes-tag IF-DEFINED PRINTER_HAS_JOB_SHEETS

    EXPECT job-spooling-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?job-spooling-supported OF-TYPE keyword IN-GROUP printer-attributes-tag COUNT 1

    EXPECT max-client-info-supported IF-DEFINED PRINTER_HAS_CLIENT_INFO
    EXPECT ?max-client-info-supported OF-TYPE integer(4:MAX) IN-GROUP printer-attributes-tag COUNT 1

    EXPECT page-ranges-supported DEFINE-MATCH PRINTER_HAS_PAGE_RANGES
    EXPECT max-page-ranges-supported OF-TYPE integer(1:MAX) IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_PAGE_RANGES

    EXPECT media-col-supported DEFINE-MATCH PRINTER_HAS_MEDIA_COL

    EXPECT media-col-database IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?media-col-database OF-TYPE collection IN-GROUP printer-attributes-tag
    EXPECT media-col-database/media-size OF-TYPE collection COUNT 1 IF-DEFINED PRINTER_HAS_MEDIA_COL

    EXPECT media-col-default IF-DEFINED REQUIRE_JOBEXT
    EXPECT media-col-default OF-TYPE collection IN-GROUP printer-attributes-tag COUNT 1 IF-DEFINED PRINTER_HAS_MEDIA_COL
    EXPECT media-col-default/media-size OF-TYPE collection COUNT 1 IF-DEFINED PRINTER_HAS_MEDIA_COL

    EXPECT media-col-ready IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?media-col-ready OF-TYPE collection IN-GROUP printer-attributes-tag
    EXPECT media-col-ready/media-size OF-TYPE collection COUNT 1 IF-DEFINED PRINTER_HAS_MEDIA_COL

    EXPECT media-col-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT media-col-supported OF-TYPE keyword IN-GROUP printer-attributes-tag IF-DEFINED PRINTER_HAS_MEDIA_COL
    EXPECT media-col-supported WITH-VALUE media-back-coating DEFINE-MATCH PRINTER_HAS_MEDIA_BACK_COATING
    EXPECT media-col-supported WITH-VALUE media-bottom-margin IF-DEFINED REQUIRE_JOBEXT
    EXPECT media-col-supported WITH-VALUE media-color DEFINE-MATCH PRINTER_HAS_MEDIA_COLOR
    EXPECT media-col-supported WITH-VALUE media-front-coating DEFINE-MATCH PRINTER_HAS_MEDIA_FRONT_COATING
    EXPECT media-col-supported WITH-VALUE media-grain DEFINE-MATCH PRINTER_HAS_MEDIA_GRAIN
    EXPECT media-col-supported WITH-VALUE media-hole-count DEFINE-MATCH PRINTER_HAS_MEDIA_HOLE_COUNT
    EXPECT media-col-supported WITH-VALUE media-key DEFINE-MATCH PRINTER_HAS_MEDIA_KEY
    EXPECT media-col-supported WITH-VALUE media-left-margin IF-DEFINED REQUIRE_JOBEXT
    EXPECT media-col-supported WITH-VALUE media-order-count DEFINE-MATCH PRINTER_HAS_MEDIA_ORDER_COUNT
    EXPECT media-col-supported WITH-VALUE media-pre-printed DEFINE-MATCH PRINTER_HAS_MEDIA_PRE_PRINTED
    EXPECT media-col-supported WITH-VALUE media-recycled DEFINE-MATCH PRINTER_HAS_MEDIA_RECYCLED
    EXPECT media-col-supported WITH-VALUE media-right-margin IF-DEFINED REQUIRE_JOBEXT
    EXPECT media-col-supported WITH-VALUE media-size IF-DEFINED REQUIRE_JOBEXT
    EXPECT media-col-supported WITH-VALUE media-source IF-DEFINED REQUIRE_JOBEXT
    EXPECT media-col-supported WITH-VALUE media-thickness DEFINE-MATCH PRINTER_HAS_MEDIA_THICKNESS
    EXPECT media-col-supported WITH-VALUE media-tooth DEFINE-MATCH PRINTER_HAS_MEDIA_TOOTH
    EXPECT media-col-supported WITH-VALUE media-top-margin IF-DEFINED REQUIRE_JOBEXT
    EXPECT media-col-supported WITH-VALUE media-type IF-DEFINED REQUIRE_JOBEXT
    EXPECT media-col-supported WITH-VALUE media-weight DEFINE-MATCH PRINTER_HAS_MEDIA_WEIGHT

    EXPECT media-back-coating-supported IF-DEFINED PRINTER_HAS_MEDIA_BACK_COATING
    EXPECT ?media-back-coating-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-bottom-margin-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?media-bottom-margin-supported OF-TYPE integer(0:MAX) IN-GROUP printer-attributes-tag

    EXPECT media-color-supported IF-DEFINED PRINTER_HAS_MEDIA_COLOR
    EXPECT ?media-color-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-front-coating-supported IF-DEFINED PRINTER_HAS_MEDIA_FRONT_COATING
    EXPECT ?media-front-coating-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-grain-supported IF-DEFINED PRINTER_HAS_MEDIA_GRAIN
    EXPECT ?media-grain-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-hole-count-supported IF-DEFINED PRINTER_HAS_MEDIA_HOLE_COUNT
    EXPECT ?media-hole-count-supported OF-TYPE rangeOfInteger(0:MAX) IN-GROUP printer-attributes-tag

    EXPECT media-key-supported IF-DEFINED PRINTER_HAS_MEDIA_KEY
    EXPECT ?media-key-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-left-margin-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?media-left-margin-supported OF-TYPE integer(0:MAX) IN-GROUP printer-attributes-tag

    EXPECT media-order-count-supported IF-DEFINED PRINTER_HAS_MEDIA_ORDER_COUNT
    EXPECT ?media-order-count-supported OF-TYPE rangeOfInteger(0:MAX) IN-GROUP printer-attributes-tag

    EXPECT media-pre-printed-supported IF-DEFINED PRINTER_HAS_MEDIA_PRE_PRINTED
    EXPECT ?media-pre-printed-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-recycled-supported IF-DEFINED PRINTER_HAS_MEDIA_RECYCLED
    EXPECT ?media-recycled-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-right-margin-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?media-right-margin-supported OF-TYPE integer(0:MAX) IN-GROUP printer-attributes-tag

    EXPECT media-size-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?media-size-supported OF-TYPE collection IN-GROUP printer-attributes-tag
    EXPECT-ALL media-size-supported/x-dimension IF-DEFINED REQUIRE_JOBEXT
    EXPECT-ALL ?media-size-supported/x-dimension OF-TYPE integer(0:MAX)|rangeOfInteger(0:MAX)
    EXPECT-ALL media-size-supported/y-dimension IF-DEFINED REQUIRE_JOBEXT
    EXPECT-ALL ?media-size-supported/y-dimension OF-TYPE integer(0:MAX)|rangeOfInteger(0:MAX)

    EXPECT media-source-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?media-source-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-thickness-supported IF-DEFINED PRINTER_HAS_MEDIA_THICKNESS
    EXPECT ?media-thickness-supported OF-TYPE rangeOfInteger(1:MAX) IN-GROUP printer-attributes-tag

    EXPECT media-tooth-supported IF-DEFINED PRINTER_HAS_MEDIA_TOOTH
    EXPECT ?media-tooth-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-top-margin-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?media-top-margin-supported OF-TYPE integer(0:MAX) IN-GROUP printer-attributes-tag

    EXPECT media-type-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?media-type-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag

    EXPECT media-weight-supported IF-DEFINED PRINTER_HAS_MEDIA_WEIGHT
    EXPECT ?media-weight-supported OF-TYPE rangeOfInteger(1:MAX) IN-GROUP printer-attributes-tag

    EXPECT job-creation-attributes-supported WITH-VALUE output-device DEFINE-MATCH PRINTER_HAS_OUTPUT_DEVICE
    EXPECT output-device-supported IF-DEFINED PRINTER_HAS_OUTPUT_DEVICE
    EXPECT ?output-device-supported OF-TYPE name(127) IN-GROUP printer-attributes-tag

    EXPECT print-content-optimize-supported DEFINE-MATCH PRINTER_HAS_PRINT_CONTENT_OPTIMIZE
    EXPECT print-content-optimize-default IF-DEFINED PRINTER_HAS_PRINT_CONTENT_OPTIMIZE
    EXPECT ?print-content-optimize-default OF-TYPE keyword IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE-FROM print-content-optimize-supported
    EXPECT ?print-content-optimize-supported OF-TYPE keyword IN-GROUP printer-attributes-tag

    EXPECT printer-requested-client-type IF-DEFINED PRINTER_HAS_CLIENT_INFO
    EXPECT ?printer-requested-client-type OF-TYPE enum IN-GROUP printer-attributes-tag

    EXPECT which-jobs-supported IF-DEFINED REQUIRE_JOBEXT
    EXPECT ?which-jobs-supported OF-TYPE keyword IN-GROUP printer-attributes-tag
}

# client-info
{
    SKIP-IF-DEFINED NOPRINT
    SKIP-IF-NOT-DEFINED PRINTER_HAS_CLIENT_INFO

    NAME "Print-Job with client-info"
    OPERATION Print-Job

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR naturalLanguage attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR name requesting-user-name $user
    ATTR name job-name "client-info test"
    ATTR mimeMediaType document-format $filetype
    ATTR collection client-info {
        MEMBER name client-name "ipptool"
        MEMBER text client-patches ""
        MEMBER text client-string-version "3.0.1.2"
        MEMBER octetString client-version <0003000000010002>
    }
    FILE $filename

    STATUS successful-ok
}

{
    SKIP-IF-DEFINED NOPRINT
    SKIP-IF-NOT-DEFINED PRINTER_HAS_CLIENT_INFO

    NAME "Get-Job-Attributes for client-info"
    OPERATION Get-Job-Attributes

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR naturalLanguage attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR integer job-id $job-id
    ATTR name requesting-user-name $user

    STATUS successful-ok

    EXPECT client-info IN-GROUP job-attributes-tag OF-TYPE collection COUNT 1
    EXPECT client-info/client-name OF-TYPE name COUNT 1 WITH-VALUE "ipptool"
    EXPECT client-info/client-patches OF-TYPE text COUNT 1 WITH-VALUE ""
    EXPECT client-info/client-string-version OF-TYPE text COUNT 1 WITH-VALUE "3.0.1.2"
    EXPECT client-info/client-version OF-TYPE octetString COUNT 1 WITH-VALUE <0003000000010002>

    DISPLAY client-info
}

{
    SKIP-IF-DEFINED NOPRINT
    SKIP-IF-NOT-DEFINED job-id

    NAME "Get-Job-Attributes Until Job Complete"
    OPERATION Get-Job-Attributes

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR naturalLanguage attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR integer job-id $job-id
    ATTR name requesting-user-name $user

    STATUS successful-ok
    EXPECT job-state IN-GROUP job-attributes-tag OF-TYPE enum COUNT 1 WITH-VALUE >6 REPEAT-NO-MATCH REPEAT-LIMIT 30
    DISPLAY job-state
}

# media-col
{
    SKIP-IF-DEFINED NOPRINT

    NAME "Print-Job with media-col"
    OPERATION Print-Job

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR naturalLanguage attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR name requesting-user-name $user
    ATTR name job-name "media-col test"
    ATTR mimeMediaType document-format $filetype

    GROUP job-attributes-tag
    ATTR collection media-col {
        MEMBER collection media-size {
            MEMBER integer x-dimension 21000
            MEMBER integer y-dimension 29700
        }
    }
    FILE $filename

    STATUS successful-ok
    EXPECT job-id IN-GROUP job-attributes-tag OF-TYPE integer COUNT 1 WITH-VALUE >0
}

{
    SKIP-IF-DEFINED NOPRINT
    SKIP-IF-NOT-DEFINED job-id

    NAME "Get-Job-Attributes for media-col"
    OPERATION Get-Job-Attributes

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR naturalLanguage attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR integer job-id $job-id
    ATTR name requesting-user-name $user

    STATUS successful-ok

    EXPECT media-col IN-GROUP job-attributes-tag OF-TYPE collection COUNT 1
    EXPECT media-col/media-size OF-TYPE collection COUNT 1
    EXPECT media-col/media-size/x-dimension OF-TYPE integer COUNT 1 WITH-VALUE 21000
    EXPECT media-col/media-size/y-dimension OF-TYPE integer COUNT 1 WITH-VALUE 29700

    DISPLAY media-col
}

{
    SKIP-IF-DEFINED NOPRINT
    SKIP-IF-NOT-DEFINED job-id

    NAME "Get-Job-Attributes Until Job Complete"
    OPERATION Get-Job-Attributes

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR naturalLanguage attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR integer job-id $job-id
    ATTR name requesting-user-name $user

    STATUS successful-ok
    EXPECT job-state IN-GROUP job-attributes-tag OF-TYPE enum COUNT 1 WITH-VALUE >6 REPEAT-NO-MATCH REPEAT-LIMIT 30
    DISPLAY job-state
}

# print-content-optimize
{
    SKIP-IF-DEFINED NOPRINT
    SKIP-IF-NOT-DEFINED PRINTER_HAS_PRINT_CONTENT_OPTIMIZE

    NAME "Print-Job with print-content-optimize"
    OPERATION Print-Job

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR naturalLanguage attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR name requesting-user-name $user
    ATTR name job-name "print-content-optimize test"
    ATTR mimeMediaType document-format $filetype

    GROUP job-attributes-tag
    ATTR keyword print-content-optimize auto
    FILE $filename

    STATUS successful-ok
    EXPECT job-id IN-GROUP job-attributes-tag OF-TYPE integer COUNT 1 WITH-VALUE >0
}

{
    SKIP-IF-DEFINED NOPRINT
    SKIP-IF-NOT-DEFINED job-id
    SKIP-IF-NOT-DEFINED PRINTER_HAS_PRINT_CONTENT_OPTIMIZE

    NAME "Get-Job-Attributes for print-content-optimize"
    OPERATION Get-Job-Attributes

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR naturalLanguage attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR integer job-id $job-id
    ATTR name requesting-user-name $user

    STATUS successful-ok

    EXPECT print-content-optimize IN-GROUP job-attributes-tag OF-TYPE keyword COUNT 1 WITH-VALUE auto

    DISPLAY print-content-optimize
}

{
    SKIP-IF-DEFINED NOPRINT
    SKIP-IF-NOT-DEFINED job-id
    SKIP-IF-NOT-DEFINED PRINTER_HAS_PRINT_CONTENT_OPTIMIZE

    NAME "Get-Job-Attributes Until Job Complete"
    OPERATION Get-Job-Attributes

    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR naturalLanguage attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR integer job-id $job-id
    ATTR name requesting-user-name $user

    STATUS successful-ok
    EXPECT job-state IN-GROUP job-attributes-tag OF-TYPE enum COUNT 1 WITH-VALUE >6 REPEAT-NO-MATCH REPEAT-LIMIT 30
    DISPLAY job-state
}
