From 0c9e99adc2c87a77fee8f1d34c8f9e89268a5895 Mon Sep 17 00:00:00 2001 From: Mark McLaughlin Date: Thu, 29 Jul 2021 16:08:48 -0400 Subject: [PATCH] working on the basic printing badge, it's not done yet, but it's making good progress; added a function to convert TWEI values numeric values to readable strings, same as has been done previously for capabilities... --- twaincs/source/TWAIN.cs | 101 ++++++- .../Basic Printing Badge.tc | 149 +++++++++ .../Certification.tc | 91 ++++++ .../DAT_EXTIMAGEINFO.tc | 149 +++++++++ .../DAT_IMAGEFILEXFER.tc | 256 ++++++++++++++++ .../DAT_IMAGEMEMFILEXFER.tc | 285 ++++++++++++++++++ .../DAT_IMAGEMEMXFER.tc | 285 ++++++++++++++++++ .../DAT_IMAGENATIVEXFER.tc | 201 ++++++++++++ .../SetCapabilities.tc | 212 +++++++++++++ twaincs/source/twaincscert/source/terminal.cs | 44 +++ 10 files changed, 1771 insertions(+), 2 deletions(-) create mode 100644 twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/Basic Printing Badge.tc create mode 100644 twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/Certification.tc create mode 100644 twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_EXTIMAGEINFO.tc create mode 100644 twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEFILEXFER.tc create mode 100644 twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEMEMFILEXFER.tc create mode 100644 twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEMEMXFER.tc create mode 100644 twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGENATIVEXFER.tc create mode 100644 twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/SetCapabilities.tc diff --git a/twaincs/source/TWAIN.cs b/twaincs/source/TWAIN.cs index 2c15d76..8e598d9 100644 --- a/twaincs/source/TWAIN.cs +++ b/twaincs/source/TWAIN.cs @@ -2135,7 +2135,7 @@ public bool CsvToCapability(ref TW_CAPABILITY a_twcapability, ref string a_szSet { try { - a_twcapability.ConType = (TWON)Enum.Parse(typeof(TWON), asz[1].Replace("TWON_", ""), true); + a_twcapability.ConType = (TWON)Enum.Parse(typeof(TWON), asz[1].Replace("TWON_", "").Replace("twon_", ""), true); } catch { @@ -2149,7 +2149,7 @@ public bool CsvToCapability(ref TW_CAPABILITY a_twcapability, ref string a_szSet { try { - twty = (TWTY)Enum.Parse(typeof(TWTY), asz[2].Replace("TWTY_", ""), true); + twty = (TWTY)Enum.Parse(typeof(TWTY), asz[2].Replace("TWTY_", "").Replace("twty_", ""), true); } catch { @@ -4213,6 +4213,103 @@ public static string CvtCapValueFromEnum(CAP a_cap, string a_szValue) } } + /// + /// Convert a value to the 'friendly' name, based on the TWEI... + /// + /// TWEI driving the conversion + /// value to convert + /// + public static string CvtTweiValueToEnum(TWEI a_twei, string a_szValue) + { + switch (a_twei) + { + default: return (a_szValue); + case TWEI.BARCODECONFIDENCE: return (a_szValue); + case TWEI.BARCODECOUNT: return (a_szValue); + case TWEI.BARCODEROTATION: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.BARCODETEXT: return (a_szValue); + case TWEI.BARCODETEXT2: return (a_szValue); + case TWEI.BARCODETEXTLENGTH: return (a_szValue); + case TWEI.BARCODETYPE: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.BARCODEX: return (a_szValue); + case TWEI.BARCODEY: return (a_szValue); + case TWEI.BLACKSPECKLESREMOVED: return (a_szValue); + case TWEI.BOOKNAME: return (a_szValue); + case TWEI.CAMERA: return (a_szValue); + case TWEI.CHAPTERNUMBER: return (a_szValue); + case TWEI.DESHADEBLACKCOUNTNEW: return (a_szValue); + case TWEI.DESHADEBLACKCOUNTOLD: return (a_szValue); + case TWEI.DESHADEBLACKRLMAX: return (a_szValue); + case TWEI.DESHADEBLACKRLMIN: return (a_szValue); + case TWEI.DESHADECOUNT: return (a_szValue); + case TWEI.DESHADEHEIGHT: return (a_szValue); + case TWEI.DESHADELEFT: return (a_szValue); + case TWEI.DESHADESIZE: return (a_szValue); + case TWEI.DESHADETOP: return (a_szValue); + case TWEI.DESHADEWHITECOUNTNEW: return (a_szValue); + case TWEI.DESHADEWHITECOUNTOLD: return (a_szValue); + case TWEI.DESHADEWHITERLAVE: return (a_szValue); + case TWEI.DESHADEWHITERLMAX: return (a_szValue); + case TWEI.DESHADEWHITERLMIN: return (a_szValue); + case TWEI.DESHADEWIDTH: return (a_szValue); + case TWEI.DESKEWSTATUS: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.DOCUMENTNUMBER: return (a_szValue); + case TWEI.ENDORSEDTEXT: return (a_szValue); + case TWEI.FILESYSTEMSOURCE: return (a_szValue); + case TWEI.FORMCONFIDENCE: return (a_szValue); + case TWEI.FORMHORZDOCOFFSET: return (a_szValue); + case TWEI.FORMTEMPLATEMATCH: return (a_szValue); + case TWEI.FORMTEMPLATEPAGEMATCH: return (a_szValue); + case TWEI.FORMVERTDOCOFFSET: return (a_szValue); + case TWEI.FRAME: return (a_szValue); + case TWEI.FRAMENUMBER: return (a_szValue); + case TWEI.HORZLINECOUNT: return (a_szValue); + case TWEI.HORZLINELENGTH: return (a_szValue); + case TWEI.HORZLINETHICKNESS: return (a_szValue); + case TWEI.HORZLINEXCOORD: return (a_szValue); + case TWEI.HORZLINEYCOORD: return (a_szValue); + case TWEI.IAFIELDA_VALUE: return (a_szValue); + case TWEI.IAFIELDB_VALUE: return (a_szValue); + case TWEI.IAFIELDC_VALUE: return (a_szValue); + case TWEI.IAFIELDD_VALUE: return (a_szValue); + case TWEI.IAFIELDE_VALUE: return (a_szValue); + case TWEI.IALEVEL: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.ICCPROFILE: return (a_szValue); + case TWEI.IMAGEMERGED: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.LASTSEGMENT: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.MAGDATA: return (a_szValue); + case TWEI.MAGDATALENGTH: return (a_szValue); + case TWEI.MAGTYPE: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.PAGENUMBER: return (a_szValue); + case TWEI.PAGESIDE: return (a_szValue); + case TWEI.PAPERCOUNT: return (a_szValue); + case TWEI.PATCHCODE: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.PIXELFLAVOR: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.PRINTER: return (CvtCapValueToEnumHelper(a_szValue)); + case TWEI.PRINTERTEXT: return (a_szValue); + case TWEI.SEGMENTNUMBER: return (a_szValue); + case TWEI.SKEWCONFIDENCE: return (a_szValue); + case TWEI.SKEWFINALANGLE: return (a_szValue); + case TWEI.SKEWORIGINALANGLE: return (a_szValue); + case TWEI.SKEWWINDOWX1: return (a_szValue); + case TWEI.SKEWWINDOWX2: return (a_szValue); + case TWEI.SKEWWINDOWX3: return (a_szValue); + case TWEI.SKEWWINDOWX4: return (a_szValue); + case TWEI.SKEWWINDOWY1: return (a_szValue); + case TWEI.SKEWWINDOWY2: return (a_szValue); + case TWEI.SKEWWINDOWY3: return (a_szValue); + case TWEI.SKEWWINDOWY4: return (a_szValue); + case TWEI.SPECKLESREMOVED: return (a_szValue); + case TWEI.TWAINDIRECTMETADATA: return (a_szValue); + case TWEI.VERTLINECOUNT: return (a_szValue); + case TWEI.VERTLINELENGTH: return (a_szValue); + case TWEI.VERTLINETHICKNESS: return (a_szValue); + case TWEI.VERTLINEXCOORD: return (a_szValue); + case TWEI.VERTLINEYCOORD: return (a_szValue); + case TWEI.WHITESPECKLESREMOVED: return (a_szValue); + } + } + #endregion diff --git a/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/Basic Printing Badge.tc b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/Basic Printing Badge.tc new file mode 100644 index 0000000..4075935 --- /dev/null +++ b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/Basic Printing Badge.tc @@ -0,0 +1,149 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Printing Badge +; These tests establish the minimum requirements for a TWAIN driver to claim that is has printing +; support. To pass the driver must support the following capabilites: +; CAP_PRINTERENABLED +; CAP_PRINTER +; CAP_PRINTERMODE +; CAP_PRINTERSTRING +; CAP_PRINTERINDEX +; CAP_PRINTERSUFFIX +; CAP_PRINTERVERTICALOFFSET +; +; And the following extended image info items: +; TWEI_PRINTERTEXT +; TWEI_PRINTER +; +; Arguments +; arg:1 - TW_IDENTITY.ProductName of scanner to test +; +; Globals +; (none) +; +; Locals +; certifyresult - track if we fail +; +; Returns +; pass or fail +; + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Initialize... +; +setlocal certifyresult 'pass' ; assume we'll pass + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Reset to a known state... +; +setlocal name 'MSG_RESETALL' +dsmentry src ds dg_control dat_capability msg_resetall '0,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.MSG_RESETALL.FAIL +echo.passfail '${get:name}' 'pass' +goto MAIN.MSG_RESETALL.DONE +; +:MAIN.MSG_RESETALL.FAIL +echo.passfail '${get:name}' 'skip - ${sts:} ${ret:}' +setlocal certifyresult 'fail' +goto MAIN.DONE +:MAIN.MSG_RESETALL.DONE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_PRINTERENABLED must be supported, and must offer both TRUE +; and FALSE, and must currently be FALSE, otherwise skip it all +; +setlocal name 'CAP_PRINTERENBLED is supported' +dsmentry src ds dg_control dat_capability msg_get 'CAP_PRINTERENABLED,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.CAP_PRINTERENABLEDSUPPORTED.SKIP +if '${ret:},' !~contains ',TRUE,' goto MAIN.CAP_PRINTERENABLEDSUPPORTED.SKIP +if '${ret:},' !~contains ',FALSE,' goto MAIN.CAP_PRINTERENABLEDSUPPORTED.SKIP +echo.passfail '${get:name}' 'pass' +goto MAIN.CAP_PRINTERENABLEDSUPPORTED.DONE +; +:MAIN.CAP_PRINTERENABLEDSUPPORTED.SKIP +echo.passfail '${get:name}' 'skip - ${sts:} ${ret:}' +setlocal certifyresult 'skip' +goto MAIN.DONE +:MAIN.CAP_PRINTERENABLEDSUPPORTED.DONE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_SUPPORTEDCAPS: check that all required capabilities are reported +; +setlocal name 'CAP_SUPPORTEDCAPS MSG_GET' +dsmentry src ds dg_control dat_capability msg_get 'CAP_SUPPORTEDCAPS,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.CAP_SUPPORTEDCAPS.FAIL +echo.passfail '${get:name}' 'pass' +; +setlocal name 'CAP_SUPPORTEDCAPS CAP_PRINTERENABLED found' +if '${ret:},' !~contains ',CAP_PRINTERENABLED,' goto MAIN.CAP_SUPPORTEDCAPS.FAIL +echo.passfail '${get:name}' 'pass' +; +setlocal name 'CAP_SUPPORTEDCAPS CAP_PRINTER found' +if '${ret:},' !~contains ',CAP_PRINTER,' goto MAIN.CAP_SUPPORTEDCAPS.FAIL +echo.passfail '${get:name}' 'pass' +; +setlocal name 'CAP_SUPPORTEDCAPS CAP_PRINTERMODE found' +if '${ret:},' !~contains ',CAP_PRINTERMODE,' goto MAIN.CAP_SUPPORTEDCAPS.FAIL +echo.passfail '${get:name}' 'pass' +; +setlocal name 'CAP_SUPPORTEDCAPS CAP_PRINTERSTRING found' +if '${ret:},' !~contains ',CAP_PRINTERSTRING,' goto MAIN.CAP_SUPPORTEDCAPS.FAIL +echo.passfail '${get:name}' 'pass' +; +setlocal name 'CAP_SUPPORTEDCAPS CAP_PRINTERINDEX found' +if '${ret:},' !~contains ',CAP_PRINTERINDEX,' goto MAIN.CAP_SUPPORTEDCAPS.FAIL +echo.passfail '${get:name}' 'pass' +; +setlocal name 'CAP_SUPPORTEDCAPS CAP_PRINTERSUFFIX found' +if '${ret:},' !~contains ',CAP_PRINTERSUFFIX,' goto MAIN.CAP_SUPPORTEDCAPS.FAIL +echo.passfail '${get:name}' 'pass' +; +setlocal name 'CAP_SUPPORTEDCAPS CAP_PRINTERVERTICALOFFSET found' +if '${ret:},' !~contains ',CAP_PRINTERVERTICALOFFSET,' goto MAIN.CAP_SUPPORTEDCAPS.FAIL +echo.passfail '${get:name}' 'pass' +goto MAIN.CAP_SUPPORTEDCAPS.DONE +; +:MAIN.CAP_SUPPORTEDCAPS.FAIL +echo.passfail '${get:name}' 'fail - ${sts:} ${ret:}' +setlocal certifyresult 'fail' +goto MAIN.DONE +:MAIN.CAP_SUPPORTEDCAPS.DONE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; ICAP_SUPPORTEDEXTIMAGEINFO: check that all metadata is reported +; +setlocal name 'ICAP_SUPPORTEDEXTIMAGEINFO MSG_GET' +dsmentry src ds dg_control dat_capability msg_get 'ICAP_SUPPORTEDEXTIMAGEINFO,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ICAP_SUPPORTEDEXTIMAGEINFO.FAIL +echo.passfail '${get:name}' 'pass' +; +setlocal name 'ICAP_SUPPORTEDEXTIMAGEINFO TWEI_PRINTERTEXT found' +if '${ret:},' !~contains ',TWEI_PRINTERTEXT,' goto MAIN.ICAP_SUPPORTEDEXTIMAGEINFO.FAIL +echo.passfail '${get:name}' 'pass' +; +setlocal name 'ICAP_SUPPORTEDEXTIMAGEINFO TWEI_PRINTER found' +if '${ret:},' !~contains ',TWEI_PRINTER,' goto MAIN.ICAP_SUPPORTEDEXTIMAGEINFO.FAIL +echo.passfail '${get:name}' 'pass' +goto MAIN.ICAP_SUPPORTEDEXTIMAGEINFO.DONE +; +:MAIN.ICAP_SUPPORTEDEXTIMAGEINFO.FAIL +echo.passfail '${get:name}' 'fail - ${sts:} ${ret:}' +setlocal certifyresult 'fail' +:MAIN.ICAP_SUPPORTEDEXTIMAGEINFO.DONE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; All done... +; +:MAIN.DONE +return '${get:certifyresult}' diff --git a/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/Certification.tc b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/Certification.tc new file mode 100644 index 0000000..4e6f74f --- /dev/null +++ b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/Certification.tc @@ -0,0 +1,91 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Basic Printing Badge +; Check if Basic Printing is supported by the driver. This is a badge, failure does invalidate +; scanner certification. Passage adds Basic Printing support to the cert. +; +; Printing is complex. This badge checks that a driver allows the basic ability to print something +; on a document. It does not require all the possible printing features described by TWAIN. +; +; Arguments +; arg:1 - TW_IDENTITY.ProductName of scanner to test +; arg:2 - global to set on fail +; +; Globals +; g_localcertifyresult - global to report to caller on fail +; +; Locals +; twidentity.productname - product name of scanner to test +; +; Returns +; (none) +; +; History +; v1.0 17-May-2021 - first version +; + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Initialize stuff, load tables if not already done for us... +; +echo.titlesuite 'Basic Printing Badge v1.0 13-Jul-2021' +echo.yellow '*************************************************************************************' +echo.yellow '*** This test is for the Basic Printing Badge. Failing means the driver does not ***' +echo.yellow '*** support this functionality. It does not prevent it from being certified. ***' +echo.yellow '*************************************************************************************' +setlocal twidentity.productname '${arg:1}' +setglobal g_localcertifyresult 'pass' ; assume success +if '${get:TW_ARRAY.ItemType}' != '' goto MAIN.LOADTABLES.SKIP +run '${folder:certification}/LoadTables' +:MAIN.LOADTABLES.SKIP + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Run the tests... +; +call CERTIFY '${folder:certification}/Opends' '${get:twidentity.productname}' g_localcertifyresult embedded +if '${get:g_localcertifyresult}' == 'fail' goto MAIN.CLOSEDS +call CERTIFY 'Basic Printing Badge' '${get:twidentity.productname}' g_localcertifyresult +call CERTIFY 'DAT_IMAGENATIVEXFER' '${get:twidentity.productname}' '${get:certifyresult}' 'FALSE' '${folder:parent}' +call CERTIFY 'DAT_IMAGEMEMXFER' '${get:twidentity.productname}' '${get:certifyresult}' 'FALSE' '${folder:parent}' +call CERTIFY 'DAT_IMAGEFILEXFER' '${get:twidentity.productname}' '${get:certifyresult}' 'FALSE' '${folder:parent}' +call CERTIFY 'DAT_IMAGEMEMFILEXFER' '${get:twidentity.productname}' '${get:certifyresult}' 'FALSE' '${folder:parent}' +:MAIN.CLOSEDS +call CERTIFY '${folder:certification}/Closeds' '${get:twidentity.productname}' g_localcertifyresult embedded + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Summary and cleanup... +; +; Did we pass? +if '${get:g_localcertifyresult}' != 'pass' goto MAIN.ERROR +echo.passfail 'SUMMARY' 'pass' +return 'pass' +; +; Ruh-roh... +:MAIN.ERROR +echo.passfail 'SUMMARY' 'fail' +setglobal '${arg:2}' 'fail' +return 'fail' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Function: Certify +; arg:1 - script to run +; arg:2 - TW_IDENTITY.ProductName of scanner to test +; arg:3 - global value to update on fail +; arg:4 - embeded flag for open/close +; returns: (none) +; +:CERTIFY +; +run '${arg:1}' '${arg:2}' '${arg:4}' +if '${ret:}' != 'pass' goto CERTIFY.FAIL +return 'pass' +; +:CERTIFY.FAIL +setglobal '${arg:3}' 'fail' +return 'fail' diff --git a/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_EXTIMAGEINFO.tc b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_EXTIMAGEINFO.tc new file mode 100644 index 0000000..a463140 --- /dev/null +++ b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_EXTIMAGEINFO.tc @@ -0,0 +1,149 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; DAT_EXTIMAGEINFO +; Check the return values from DAT_EXTIMAGEINFO to make sure the printer +; metadata is being properly reported. +; +; Here's the basic flow: +; DAT_EXTIMAGEINFO +; confirm that we have the following TWEI_PRINTER* items +; TWEI_PRINTERTEXT +; TWEI_PRINTER +; +; Arguments +; arg:1 - indent the passfail text +; arg:2 - base filename (no extension) +; arg:3 - expected value for TWEI_PRINTER +; +; Locals +; printerdata - the return value from DAT_EXTIMAGEINFO +; name - current test being done +; indent - indent the passfail text +; twinfo.infoid.index - index to TW_INFO[n].infoid from the start of barcodedata +; twinfo.itemtype.index - index to TW_INFO[n].itemtype from the start of barcodedata +; twinfo.numitems.index - index to TW_INFO[n].numitems from the start of barcodedata +; twinfo.returncode.index - index to TW_INFO[n].returncode from the start of barcodedata +; twinfo.item.index - index to TW_INFO[n].item from the start of barcodedata +; +; Returns +; pass or fail +; + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Get the extended image info, save the data to 'printerdata'. +; +setlocal indent '${arg:1} ' +setlocal name 'dg_image/dat_extimageinfo/msg_get' +dsmentry src ds dg_image dat_extimageinfo msg_get '2,TWEI_PRINTER,0,0,0,0,TWEI_PRINTERTEXT,0,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +setlocal printerdata '${ret:}' +filewrite '${arg:2}_extimageinfo.txt' '${get:printerdata}' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Confirm that we got back all the printer extimageinfo data... +; +setlocal name 'Found TWEI_PRINTER' +if '${get:printerdata}' !contains ',TWEI_PRINTER,' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +setlocal name 'Found TWEI_PRINTERTEXT' +if '${get:printerdata}' !contains ',TWEI_PRINTERTEXT,' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Init our TWINFO indecies for TW_INFO[0]... +; +setlocal twinfo.infoid.index '${get:TW_INFO.InfoID}' +setlocal twinfo.itemtype.index '${get:TW_INFO.ItemType}' +setlocal twinfo.numitems.index '${get:TW_INFO.NumItems}' +setlocal twinfo.returncode.index '${get:TW_INFO.ReturnCode}' +setlocal twinfo.item.index '${get:TW_INFO.Item}' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Validate the contents of TWEI_PRINTER, which is in TW_INFO[0]... +; +setlocal name 'TW_INFO[0].InfoID is TWEI_PRINTER' +if '${getindex:printerdata:${get:twinfo.infoid.index}}' != 'TWEI_PRINTER' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_INFO[0].ItemType is TWTY_UINT16' +if '${getindex:printerdata:${get:twinfo.itemtype.index}}' != 'TWTY_UINT16' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_INFO[0].NumItems is 1' +if '${getindex:printerdata:${get:twinfo.numitems.index}}' != '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_INFO[0].ReturnCode is TWRC_SUCCESS' +if '${getindex:printerdata:${get:twinfo.returncode.index}}' != 'TWRC_SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_INFO[0].Item is ${arg:3}' +if '${gettwei:TWEI_PRINTER:${getindex:printerdata:${get:twinfo.item.index}}}' != '${arg:3}' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Increment our TWINFO indecies for TW_INFO[1]... +; +increment twinfo.infoid.index '${get:twinfo.infoid.index}' 5 ; skip to the InfoID in the next TW_INFO +increment twinfo.itemtype.index '${get:twinfo.itemtype.index}' 5 ; skip to the InfoID in the next TW_INFO +increment twinfo.numitems.index '${get:twinfo.numitems.index}' 5 ; skip to the NumItems in the next TW_INFO +increment twinfo.returncode.index '${get:twinfo.returncode.index}' 5 ; skip to the ReturnCode in the next TW_INFO +increment twinfo.item.index '${get:twinfo.item.index}' 5 ; skip to the ReturnCode in the next TW_INFO + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Validate the contents of TWEI_PRINTERTEXT, which is in TW_INFO[1]... +; +setlocal name 'TW_INFO[1].InfoID is TWEI_PRINTERTEXT' +if '${getindex:printerdata:${get:twinfo.infoid.index}}' != 'TWEI_PRINTERTEXT' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_INFO[1].ItemType is TWTY_STR255' +if '${getindex:printerdata:${get:twinfo.itemtype.index}}' != 'TWTY_STR255' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_INFO[1].NumItems is 1' +if '${getindex:printerdata:${get:twinfo.numitems.index}}' != '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_INFO[1].ReturnCode is TWRC_SUCCESS' +if '${getindex:printerdata:${get:twinfo.returncode.index}}' != 'TWRC_SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +; The printer text is behind a handle... +setlocal handle ${getindex:printerdata:${get:twinfo.item.index}} +setlocal printertext '${gethandle:${get:handle}:TWTY_STR255:0}' +echo 'mlm>>> <${get:printertext}>' +; +setlocal name 'TW_INFO[1].Item contains "TWAIN"' +if '${get:printertext}' !contains 'TWAIN' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_INFO[1].Item contains "TEST"' +if '${get:printertext}' !contains 'TEST' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Summary and cleanup... +; +; Did we pass? (do an extra check) +:MAIN.PASS +return 'pass' +; +; Ruh-roh... +:MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'fail - ${sts:} ${ret:}' +return 'fail' diff --git a/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEFILEXFER.tc b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEFILEXFER.tc new file mode 100644 index 0000000..0161d08 --- /dev/null +++ b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEFILEXFER.tc @@ -0,0 +1,256 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; DAT_IMAGEFILEXFER +; This test scans one sheet of paper for the default pixeltype. An ADF +; is required to pass this test, but that was already been tested before +; we got to this function. +; +; Here's the basic flow: +; SetCapabilities +; start scanning +; while images +; transfer image +; DAT_EXTIMAGEINFO +; end image +; end +; end scanning +; verify the results +; +; The test passes if: +; - all of the capabilities can be set +; - TWEI_PRINTER matches CAP_PRINTER +; - TWEI_PRINTERSTRING starts with 'TWAIN' and ends with 'TEST' +; +; Arguments +; arg:1 - TW_IDENTITY.ProductName of scanner to test +; arg:2 - global for us to update on failure +; arg:3 - value of ShowUI (TRUE or FALSE) +; arg:4 - test name for the image folder +; arg:5 - expected value for TWEI_PRINTER +; +; Locals +; name - current test being done +; indent - indent the passfail text +; twimageinfo.compression - compression for current image +; showui - value of showui +; +; image.count - count of images from 1 +; image.folder - folder to put the images in +; +; feederenabled.list - scanner's feederenabled values +; feederenabled.index - index of feederenabled values +; feederenabled.value - current feederenabled value +; +; pixeltype.list - scanner's pixeltype values for this feederenabled +; pixeltype.index - index of pixeltype values +; pixeltype.value - current pixeltype value +; +; Returns +; pass or fail +; + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; If not supported, quietly leave... +; +if '${get:g_xfermech}' ~contains 'TWSX_FILE' goto MAIN.CONTINUE +return 'pass' +:MAIN.CONTINUE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Initialize... +; +echo.titletest 'DAT_IMAGEFILEXFER v1.0 28-Jun-2021' +; +setlocal indent '' +setlocal image.count '0' +setlocal image.folder '${folder:certimages}/${arg:4}/DAT_IMAGEFILEXFER' +setlocal image.showname '' +setlocal showui '${arg:3}' +; +setglobal g_barcodemaxsearchpriorities.max '0' +setglobal g_barcodecount.none '0' +setglobal g_barcodecount.one '0' +setglobal g_barcodecount.many '0' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Clean the image folder for this test... +; +image cleanfolderandmeta '${get:image.folder}' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; SetCapabilities +; This resets the driver and sets all the capabilities we need for the test. +; If its return code is not 'pass', end with an error +; +run SetCapabilities 'TWSX_FILE' '${get:indent}' +if '${ret:}' != 'pass' goto MAIN.ERROR.FAIL + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Prompt the user... +; +echo.prompt +echo.prompt "Scanning will take place during this test. There will be no" +echo.prompt "need to press any button on the TWAIN user interface to start" +echo.prompt "the scanner. A progress indicator may appear during scanning." +echo.prompt +echo.prompt "Place 1 sheet in the scanner's feeder. The scanner will print" +echo.prompt "text on this sheet." +echo.prompt +pause '(press the ENTER key when ready to continue)' +echo.prompt + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Start scanning... +; +:MAIN.USERINTERFACE +setlocal name 'dg_control/dat_userinterface/msg_enableds' +wait reset +dsmentry src null dg_control dat_userinterface msg_enableds '${get:showui},0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Wait for MSG_XFERREADY, if we don't see it then scoot... +; +setlocal name 'wait ${get:sys_waittimeout} seconds for MSG_XFERREADY' +wait '${get:sys_waittimeout}000' +if '${ret:}' !~contains 'msg_xferready' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Get information about the image... +; +:MAIN.IMAGEINFO.NEXT +setlocal name 'dg_image/dat_imageinfo/msg_get' +dsmentry src ds dg_image dat_imageinfo msg_get '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +setlocal twimageinfo.compression '${ret:${get:index.twimageinfo.compression}}' +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Set up the file transfer... +; +increment image.count '${get:image.count}' 1 +if '${get:twimageinfo.compression}' == 'JPEG' goto MAIN.SETUPFILEXFER.JPEG +setlocal image.showname 'DAT_IMAGEFILEXFER/adf${format:D6|${get:image.count}}.tif' +setlocal twsetupfilexfer.filename '${get:image.folder}/adf${format:D6|${get:image.count}}.tif' +setlocal twsetupfilexfer.format 'TWFF_TIFF' +goto MAIN.SETUPFILEXFER +:MAIN.SETUPFILEXFER.JPEG +setlocal image.showname 'DAT_IMAGEFILEXFER/adf${format:D6|${get:image.count}}.jpg' +setlocal twsetupfilexfer.filename '${get:image.folder}/adf${format:D6|${get:image.count}}.jpg' +setlocal twsetupfilexfer.format 'TWFF_JFIF' +:MAIN.SETUPFILEXFER +setlocal name 'dg_control/dat_setupfilexfer/msg_set' +dsmentry src ds dg_control dat_setupfilexfer msg_set '"${get:twsetupfilexfer.filename}",${get:twsetupfilexfer.format},0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Transfer the image... +; +setlocal name 'dg_image/dat_imagefilexfer/msg_get' +dsmentry src ds dg_image dat_imagefilexfer msg_get null +if '${sts:}' != 'XFERDONE' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +echo.passfail '${get:indent}image <${get:image.showname}>' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; DAT_EXTIMAGEINFO +; Check the barcode metadata... +; +run DAT_EXTIMAGEINFO '${get:indent}' '${get:image.folder}/adf${format:D6|${get:image.count}}' '${get:g_printer}' +if '${ret:}' != 'pass' goto MAIN.ERROR.FAIL + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; End the transfer, see if we're done... +; +setlocal name 'dg_control/dat_pendingxfers/msg_endxfer' +dsmentry src ds dg_control dat_pendingxfers msg_endxfer '0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +if '${ret:${get:TW_PENDINGXFERS.Count}}' != '0' goto MAIN.IMAGEINFO.NEXT + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; We're out of images, so disable... +; +setlocal name 'dg_control/dat_userinterface/msg_disableds' +dsmentry src ds dg_control dat_userinterface msg_disableds '0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Check to see if we passed. We need one sheet of paper with no barcodes. Two or more sheets +; with one barcode, and no sheets with multiple barecodes if the maximum value of +; ICAP_BARCODEMAXSEARCHPRIORITIES is 1. And one or more sheets with one barcode, and one or +; more sheets with multiple barcodes of ICAP_BARCODEMAXSEARCHPRIORITIES is greater than 1. +; +setlocal name 'Final Check: detected a sheet with 0 barcodes +if '${get:g_barcodecount.none}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +if '${get:g_barcodemaxsearchpriorities.max}' >= '2' goto MAIN.FINALCHECK.MANYBARCODES +setlocal name 'Final Check: detected multiple sheets with 1 barcode' +if '${get:g_barcodecount.one}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +setlocal name 'Final Check: detected 0 sheets with many barcodes (not supported)' +if '${get:g_barcodecount.many}' > '0' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +goto MAIN.FINALCHECK.DONE +; +:MAIN.FINALCHECK.MANYBARCODES +setlocal name 'Final Check: detected a sheet with 1 barcode' +if '${get:g_barcodecount.one}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +setlocal name 'Final Check: detected a sheet with many barcodes' +if '${get:g_barcodecount.many}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +:MAIN.FINALCHECK.DONE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Summary and cleanup... +; +; Did we pass? (do an extra check) +:MAIN.PASS +echo.passfail 'SUMMARY' 'pass' +return 'pass' +; +; Ruh-roh... +:MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'fail - ${sts:} ${ret:}' +echo.passfail 'SUMMARY' 'fail' +return 'fail' +; +; Ruh-roh... +:MAIN.ERROR.FAIL +echo.passfail 'SUMMARY' 'fail' +return 'fail' diff --git a/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEMEMFILEXFER.tc b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEMEMFILEXFER.tc new file mode 100644 index 0000000..1a6d83d --- /dev/null +++ b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEMEMFILEXFER.tc @@ -0,0 +1,285 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; DAT_IMAGEMEMFILEXFER +; This test scans one sheet of paper for the default pixeltype. An ADF +; is required to pass this test, but that was already been tested before +; we got to this function. +; +; Here's the basic flow: +; SetCapabilities +; start scanning +; while images +; transfer image +; DAT_EXTIMAGEINFO +; end image +; end +; end scanning +; verify the results +; +; The test passes if: +; - all of the capabilities can be set +; - TWEI_PRINTER matches CAP_PRINTER +; - TWEI_PRINTERSTRING starts with 'TWAIN' and ends with 'TEST' +; +; Arguments +; arg:1 - TW_IDENTITY.ProductName of scanner to test +; arg:2 - global for us to update on failure +; arg:3 - value of ShowUI (TRUE or FALSE) +; arg:4 - test name for the image folder +; arg:5 - expected value for TWEI_PRINTER +; +; Locals +; name - current test being done +; indent - indent the passfail text +; imagememxfer - result of DAT_IMAGEMEMXFER call +; setupmemxfer.preferred - preferred field from DAT_SETUPMEMXFER call +; +; image.count - count of images from 1 +; image.folder - folder to put the images in +; +; feederenabled.list - scanner's feederenabled values +; feederenabled.index - index of feederenabled values +; feederenabled.value - current feederenabled value +; +; pixeltype.list - scanner's pixeltype values for this feederenabled +; pixeltype.index - index of pixeltype values +; pixeltype.value - current pixeltype value +; +; Returns +; pass or fail +; + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; If not supported, quietly leave... +; +if '${get:g_xfermech}' ~contains 'TWSX_MEMFILE' goto MAIN.CONTINUE +return 'pass' +:MAIN.CONTINUE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Initialize... +; +echo.titletest 'DAT_IMAGEMEMFILEXFER v1.0 28-Jun-2021' +; +setlocal indent '' +setlocal image.pointer '0' +setlocal image.count '0' +setlocal image.folder '${folder:certimages}/${arg:4}/DAT_IMAGEMEMFILEXFER' +setlocal showui '${arg:3}' +; +setglobal g_barcodemaxsearchpriorities.max '0' +setglobal g_barcodecount.none '0' +setglobal g_barcodecount.one '0' +setglobal g_barcodecount.many '0' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Clean the image folder for this test... +; +image cleanfolderandmeta '${get:image.folder}' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; SetCapabilities +; This resets the driver and sets all the capabilities we need for the test. +; If its return code is not 'pass', end with an error +; +run SetCapabilities 'TWSX_MEMFILE' '${get:indent}' +if '${ret:}' != 'pass' goto MAIN.ERROR.FAIL + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Get the preferred size for memory transfers, and allocate +; a pointer for the memory transfers... +; +setlocal indent ' ' +setlocal name 'dg_control/dat_setupmemxfer/msg_get' +dsmentry src ds dg_control dat_setupmemxfer msg_get '0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_SETUPMEMXFER.Preferred > 0' +setlocal setupmemxfer.preferred '${ret:${get:TW_SETUPMEMXFER.Preferred}}' +if '${get:setupmemxfer.preferred}' <= '0' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'allocate pointer for ${get:setupmemxfer.preferred} bytes' +free pointer image.pointer ; for the last loop +allocate pointer image.pointer '${get:setupmemxfer.preferred}' +if '${get:image.pointer}' == '0' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Set DAT_SETUPFILEXFER to TWFF_TIFF +; +setlocal name 'dg_control/dat_setupfilexfer/msg_set TWFF_TIFF' +dsmentry src null dg_control dat_setupfilexfer msg_set 'file,TWFF_TIFF,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Prompt the user... +; +echo.prompt +echo.prompt "Scanning will take place during this test. There will be no" +echo.prompt "need to press any button on the TWAIN user interface to start" +echo.prompt "the scanner. A progress indicator may appear during scanning." +echo.prompt +echo.prompt "Place 1 sheet in the scanner's feeder. The scanner will print" +echo.prompt "text on this sheet." +echo.prompt +pause '(press the ENTER key when ready to continue)' +echo.prompt + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Start scanning... +; +:MAIN.USERINTERFACE +setlocal name 'dg_control/dat_userinterface/msg_enableds' +wait reset +dsmentry src null dg_control dat_userinterface msg_enableds '${get:showui},0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Wait for MSG_XFERREADY, if we don't see it then scoot... +; +setlocal name 'wait ${get:sys_waittimeout} seconds for MSG_XFERREADY' +wait '${get:sys_waittimeout}000' +if '${ret:}' !~contains 'msg_xferready' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Do a memory file transfer... +; This little song and dance with the states is so that we can +; start the transfer in state 6 with each new image, but switch +; to state 7 if we need multiple calls to capture the current +; image... +; +; The saved images will be in TIFF format, which includes TIFF +; JPEG (the better form, where a simple TIFF header is added). +; +increment image.count '${get:image.count}' 1 +image free memfileimage +; +:MAIN.IMAGEMEMFILEXFER.NEXT +setlocal name 'dg_image/dat_imagememxfer/msg_get' +dsmentry src ds dg_image dat_imagememfilexfer msg_get '0,0,0,0,0,0,0,9,${get:setupmemxfer.preferred},${get:image.pointer}' +setlocal imagememxfer '${ret:}' +if '${sts:}' == 'XFERDONE' goto MAIN.IMAGEMEMFILEXFER.XFERDONE +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +; +echo.passfail '${get:indent}${get:name} SUCCESS' 'pass' +image append memfileimage '${get:imagememxfer}' +goto MAIN.IMAGEMEMFILEXFER.NEXT +; +:MAIN.IMAGEMEMFILEXFER.XFERDONE +echo.passfail '${get:indent}${get:name} XFERDONE' 'pass' +image append memfileimage '${get:imagememxfer}' +image save memfileimage memfile '${get:image.folder}/adf${format:D6|${get:image.count}}' +echo.passfail '${get:indent}image <${ret:}>' 'pass' +image free memfileimage + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; DAT_EXTIMAGEINFO +; Check the barcode metadata... +; +run DAT_EXTIMAGEINFO '${get:indent}' '${get:image.folder}/adf${format:D6|${get:image.count}}' +if '${ret:}' != 'pass' goto MAIN.ERROR.FAIL + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; End the transfer, see if we're done... +; +setlocal name 'dg_control/dat_pendingxfers/msg_endxfer' +dsmentry src ds dg_control dat_pendingxfers msg_endxfer '0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +increment image.count '${get:image.count}' 1 +if '${ret:${get:TW_PENDINGXFERS.Count}}' != '0' goto MAIN.IMAGEMEMFILEXFER.NEXT + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; We're out of images, so disable... +; +setlocal name 'dg_control/dat_userinterface/msg_disableds' +dsmentry src ds dg_control dat_userinterface msg_disableds '0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Check to see if we passed. We need one sheet of paper with no barcodes. Two or more sheets +; with one barcode, and no sheets with multiple barecodes if the maximum value of +; ICAP_BARCODEMAXSEARCHPRIORITIES is 1. And one or more sheets with one barcode, and one or +; more sheets with multiple barcodes of ICAP_BARCODEMAXSEARCHPRIORITIES is greater than 1. +; +setlocal name 'Final Check: detected a sheet with 0 barcodes +if '${get:g_barcodecount.none}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +if '${get:g_barcodemaxsearchpriorities.max}' >= '2' goto MAIN.FINALCHECK.MANYBARCODES +setlocal name 'Final Check: detected multiple sheets with 1 barcode' +if '${get:g_barcodecount.one}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +setlocal name 'Final Check: detected 0 sheets with many barcodes (not supported)' +if '${get:g_barcodecount.many}' > '0' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +goto MAIN.FINALCHECK.DONE +; +:MAIN.FINALCHECK.MANYBARCODES +setlocal name 'Final Check: detected a sheet with 1 barcode' +if '${get:g_barcodecount.one}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +setlocal name 'Final Check: detected a sheet with many barcodes' +if '${get:g_barcodecount.many}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +:MAIN.FINALCHECK.DONE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Summary and cleanup... +; +; Did we pass? (do an extra check) +:MAIN.PASS +image free memfileimage +free pointer image.pointer +echo.passfail 'SUMMARY' 'pass' +return 'pass' +; +; Ruh-roh... +:MAIN.ERROR.ECHOPASSFAIL +image free memfileimage +free pointer image.pointer +echo.passfail '${get:indent}${get:name}' 'fail - ${sts:} ${ret:}' +echo.passfail 'SUMMARY' 'fail' +return 'fail' +; +; Ruh-roh... +:MAIN.ERROR.FAIL +image free memfileimage +free pointer image.pointer +echo.passfail 'SUMMARY' 'fail' +return 'fail' diff --git a/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEMEMXFER.tc b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEMEMXFER.tc new file mode 100644 index 0000000..58af888 --- /dev/null +++ b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGEMEMXFER.tc @@ -0,0 +1,285 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; DAT_IMAGEMEMXFER +; This test scans one sheet of paper for the default pixeltype. An ADF +; is required to pass this test, but that was already been tested before +; we got to this function. +; +; Here's the basic flow: +; SetCapabilities +; start scanning +; while images +; transfer image +; DAT_EXTIMAGEINFO +; end image +; end +; end scanning +; verify the results +; +; The test passes if: +; - all of the capabilities can be set +; - TWEI_PRINTER matches CAP_PRINTER +; - TWEI_PRINTERSTRING starts with 'TWAIN' and ends with 'TEST' +; +; Arguments +; arg:1 - TW_IDENTITY.ProductName of scanner to test +; arg:2 - global for us to update on failure +; arg:3 - value of ShowUI (TRUE or FALSE) +; arg:4 - test name for the image folder +; arg:5 - expected value for TWEI_PRINTER +; +; Locals +; name - current test being done +; indent - indent the passfail text +; imageinfo - metadata for the current image +; imagememxfer - result of DAT_IMAGEMEMXFER call +; setupmemxfer.preferred - preferred field from DAT_SETUPMEMXFER call +; +; image.count - count of images from 1 +; image.folder - folder to put the images in +; +; feederenabled.list - scanner's feederenabled values +; feederenabled.index - index of feederenabled values +; feederenabled.value - current feederenabled value +; +; pixeltype.list - scanner's pixeltype values for this feederenabled +; pixeltype.index - index of pixeltype values +; pixeltype.value - current pixeltype value +; +; Returns +; pass or fail +; + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Initialize... +; +echo.titletest 'DAT_IMAGEMEMXFER v1.0 28-Jun-2021' +; +setlocal indent '' +setlocal image.pointer '0' +setlocal image.count '0' +setlocal image.folder '${folder:certimages}/${arg:4}/DAT_IMAGEMEMXFER' +setlocal showui '${arg:3}' +; +setglobal g_barcodemaxsearchpriorities.max '0' +setglobal g_barcodecount.none '0' +setglobal g_barcodecount.one '0' +setglobal g_barcodecount.many '0' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Clean the image folder for this test... +; +image cleanfolderandmeta '${get:image.folder}' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; SetCapabilities +; This resets the driver and sets all the capabilities we need for the test. +; If its return code is not 'pass', end with an error +; +run SetCapabilities 'TWSX_MEMORY' '${get:indent}' +if '${ret:}' != 'pass' goto MAIN.ERROR.FAIL + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Get the preferred size for memory transfers, and allocate +; a pointer for the memory transfers... +; +setlocal indent ' ' +setlocal name 'dg_control/dat_setupmemxfer/msg_get' +dsmentry src ds dg_control dat_setupmemxfer msg_get '0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'TW_SETUPMEMXFER.Preferred > 0' +setlocal setupmemxfer.preferred '${ret:${get:TW_SETUPMEMXFER.Preferred}}' +if '${get:setupmemxfer.preferred}' <= '0' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +setlocal name 'allocate pointer for ${get:setupmemxfer.preferred} bytes' +free pointer image.pointer ; for the last loop +allocate pointer image.pointer '${get:setupmemxfer.preferred}' +if '${get:image.pointer}' == '0' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Prompt the user... +; +echo.prompt +echo.prompt "Scanning will take place during this test. There will be no" +echo.prompt "need to press any button on the TWAIN user interface to start" +echo.prompt "the scanner. A progress indicator may appear during scanning." +echo.prompt +echo.prompt "Place 1 sheet in the scanner's feeder. The scanner will print" +echo.prompt "text on this sheet." +echo.prompt +pause '(press the ENTER key when ready to continue)' +echo.prompt + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Start scanning... +; +:MAIN.USERINTERFACE +setlocal name 'dg_control/dat_userinterface/msg_enableds' +wait reset +dsmentry src null dg_control dat_userinterface msg_enableds '${get:showui},0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Wait for MSG_XFERREADY, if we don't see it then scoot... +; +setlocal name 'wait ${get:sys_waittimeout} seconds for MSG_XFERREADY' +wait '${get:sys_waittimeout}000' +if '${ret:}' !~contains 'msg_xferready' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Do a memory transfer... +; This little song and dance with the states is so that we can +; start the transfer in state 6 with each new image, but switch +; to state 7 if we need multiple calls to capture the current +; image... +; +; The saved images will be in TIFF format, which includes TIFF +; JPEG (the better form, where a simple TIFF header is added). +; +increment image.count '${get:image.count}' 1 +image free memimage +; +:MAIN.IMAGEMEMXFER.NEXT +setlocal name 'dg_image/dat_imagememxfer/msg_get' +dsmentry src ds dg_image dat_imagememxfer msg_get '0,0,0,0,0,0,0,9,${get:setupmemxfer.preferred},${get:image.pointer}' +setlocal imagememxfer '${ret:}' +if '${sts:}' == 'XFERDONE' goto MAIN.IMAGEMEMXFER.XFERDONE +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +; +echo.passfail '${get:indent}${get:name} SUCCESS' 'pass' +image append memimage '${get:imagememxfer}' +goto MAIN.IMAGEMEMXFER.NEXT +; +:MAIN.IMAGEMEMXFER.XFERDONE +echo.passfail '${get:indent}${get:name} XFERDONE' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; We need image info to make sense of this data... +; +setlocal name 'dg_image/dat_imageinfo/msg_get' +dsmentry src ds dg_image dat_imageinfo msg_get '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0' +setlocal imageinfo '${ret:}' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Save the image... +; +image append memimage '${get:imagememxfer}' +image addheader memimage '${get:imageinfo}' +image save memimage memory '${get:image.folder}/adf${format:D6|${get:image.count}}' +echo.passfail '${get:indent}image <${ret:}>' 'pass' +image free memimage + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; DAT_EXTIMAGEINFO +; Check the barcode metadata... +; +run DAT_EXTIMAGEINFO '${get:indent}' '${get:image.folder}/adf${format:D6|${get:image.count}}' +if '${ret:}' != 'pass' goto MAIN.ERROR.FAIL + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; End the transfer, see if we're done... +; +setlocal name 'dg_control/dat_pendingxfers/msg_endxfer' +dsmentry src ds dg_control dat_pendingxfers msg_endxfer '0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +increment image.count '${get:image.count}' 1 +if '${ret:${get:TW_PENDINGXFERS.Count}}' != '0' goto MAIN.IMAGEMEMXFER.NEXT + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; We're out of images, so disable... +; +setlocal name 'dg_control/dat_userinterface/msg_disableds' +dsmentry src ds dg_control dat_userinterface msg_disableds '0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Check to see if we passed. We need one sheet of paper with no barcodes. Two or more sheets +; with one barcode, and no sheets with multiple barecodes if the maximum value of +; ICAP_BARCODEMAXSEARCHPRIORITIES is 1. And one or more sheets with one barcode, and one or +; more sheets with multiple barcodes of ICAP_BARCODEMAXSEARCHPRIORITIES is greater than 1. +; +setlocal name 'Final Check: detected a sheet with 0 barcodes +if '${get:g_barcodecount.none}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +; +if '${get:g_barcodemaxsearchpriorities.max}' >= '2' goto MAIN.FINALCHECK.MANYBARCODES +setlocal name 'Final Check: detected multiple sheets with 1 barcode' +if '${get:g_barcodecount.one}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +setlocal name 'Final Check: detected 0 sheets with many barcodes (not supported)' +if '${get:g_barcodecount.many}' > '0' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +goto MAIN.FINALCHECK.DONE +; +:MAIN.FINALCHECK.MANYBARCODES +setlocal name 'Final Check: detected a sheet with 1 barcode' +if '${get:g_barcodecount.one}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +setlocal name 'Final Check: detected a sheet with many barcodes' +if '${get:g_barcodecount.many}' < '1' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +:MAIN.FINALCHECK.DONE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Summary and cleanup... +; +; Did we pass? (do an extra check) +:MAIN.PASS +image free memimage +free pointer image.pointer +echo.passfail 'SUMMARY' 'pass' +return 'pass' +; +; Ruh-roh... +:MAIN.ERROR.ECHOPASSFAIL +image free memimage +free pointer image.pointer +echo.passfail '${get:indent}${get:name}' 'fail - ${sts:} ${ret:}' +echo.passfail 'SUMMARY' 'fail' +return 'fail' +; +; Ruh-roh... +:MAIN.ERROR.FAIL +image free memimage +free pointer image.pointer +echo.passfail 'SUMMARY' 'fail' +return 'fail' diff --git a/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGENATIVEXFER.tc b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGENATIVEXFER.tc new file mode 100644 index 0000000..b359ad3 --- /dev/null +++ b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/DAT_IMAGENATIVEXFER.tc @@ -0,0 +1,201 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; DAT_IMAGENATIVEXFER +; This test scans one sheet of paper for the default pixeltype. An ADF +; is required to pass this test, but that was already been tested before +; we got to this function. +; +; Here's the basic flow: +; SetCapabilities +; start scanning +; while images +; transfer image +; DAT_EXTIMAGEINFO +; end image +; end +; end scanning +; verify the results +; +; The test passes if: +; - all of the capabilities can be set +; - TWEI_PRINTER matches CAP_PRINTER +; - TWEI_PRINTERSTRING starts with 'TWAIN' and ends with 'TEST' +; +; Arguments +; arg:1 - TW_IDENTITY.ProductName of scanner to test +; arg:2 - global for us to update on failure +; arg:3 - value of ShowUI (TRUE or FALSE) +; arg:4 - test name for the image folder +; arg:5 - expected value for TWEI_PRINTER +; +; Globals +; g_capprinter - value of CAP_PRINTER, used to check TWEI_PRINTER +; +; Locals +; name - current test being done +; indent - indent the passfail text +; image.handle - native handle +; image.count - count of images from 1 +; image.folder - folder to put the images in +; +; Returns +; pass or fail +; + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Initialize... +; +echo.titletest 'DAT_IMAGENATIVEXFER v1.0 28-Jun-2021' +; +setlocal indent '' +setlocal image.handle '0' +setlocal image.count '1' +setlocal image.folder '${folder:certimages}/${arg:4}/DAT_IMAGENATIVEXFER' +setlocal showui '${arg:3}' +; +setglobal g_capprinter '' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Prompt the user... +; +echo.prompt +echo.prompt "Scanning will take place during this test. There will be no" +echo.prompt "need to press any button on the TWAIN user interface to start" +echo.prompt "the scanner. A progress indicator may appear during scanning." +echo.prompt +echo.prompt "Place 1 sheet in the scanner's feeder. The scanner will print" +echo.prompt "text on this sheet." +echo.prompt +pause '(press the ENTER key when ready to continue)' +echo.prompt + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Clean the image folder for this test... +; +image cleanfolderandmeta '${get:image.folder}' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; SetCapabilities +; This resets the driver and sets all the capabilities we need for the test. +; If its return code is not 'pass', end with an error +; +run SetCapabilities 'TWSX_NATIVE' '${get:indent}' g_capprinter +if '${ret:}' != 'pass' goto MAIN.ERROR.FAIL + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Check for paper in the feeder, prompt the user if we don't find any... +; +:MAIN.FEEDERLOADED +dsmentry src ds dg_control dat_capability msg_getcurrent 'CAP_FEEDERLOADED,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.FEEDERLOADED.DONE +if '${ret:${get:TW_ONEVALUE.Item}}' ~~ 'TRUE' goto MAIN.FEEDERLOADED.DONE +echo.prompt +echo.prompt "Place paper in the scanner's feeder." +pause '(press the ENTER key when ready to continue)' +:MAIN.FEEDERLOADED.DONE + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Start scanning... +; +setlocal indent ' ' +setlocal name 'dg_control/dat_userinterface/msg_enableds' +wait reset +dsmentry src null dg_control dat_userinterface msg_enableds '${get:showui},0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Wait for MSG_XFERREADY, if we don't see it then scoot... +; +setlocal name 'wait ${get:sys_waittimeout} seconds for MSG_XFERREADY' +wait '${get:sys_waittimeout}000' +if '${ret:}' !~contains 'msg_xferready' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Do a native transfer... +; +:MAIN.IMAGENATIVEXFER.NEXT +setlocal indent ' ' +setlocal name 'dg_control/dat_imagenativexfer/msg_get' +dsmentry src ds dg_image dat_imagenativexfer msg_get '0' +setlocal image.handle '${ret:}' +if '${sts:}' != 'XFERDONE' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +image save image.handle native '${get:image.folder}/adf${format:D6|${get:image.count}}' +echo.passfail '${get:indent}image <${ret:}>' 'pass' +free handle image.handle + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; DAT_EXTIMAGEINFO +; Check the printer metadata... +; +run DAT_EXTIMAGEINFO '${get:indent}' '${get:image.folder}/adf${format:D6|${get:image.count}}' ${get:g_capprinter} +if '${ret:}' != 'pass' goto MAIN.ERROR.FAIL + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; End the transfer, see if we're done. If not, go back +; to MAIN.IMAGENATIVEXFER.NEXT for another image... +; +:MAIN.PENDINGXFERS +setlocal name 'dg_control/dat_pendingxfers/msg_endxfer' +dsmentry src ds dg_control dat_pendingxfers msg_endxfer '0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' +increment image.count '${get:image.count}' 1 ; count the image +if '${ret:${get:TW_PENDINGXFERS.Count}}' != '0' goto MAIN.IMAGENATIVEXFER.NEXT + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; We're out of images, so disable... +; +setlocal name 'dg_control/dat_userinterface/msg_disableds' +dsmentry src ds dg_control dat_userinterface msg_disableds '0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Summary and cleanup... +; +; Did we pass? (do an extra check) +:MAIN.PASS +free handle image.handle +echo.passfail 'SUMMARY' 'pass' +return 'pass' +; +; Ruh-roh... +:MAIN.ERROR.ECHOPASSFAIL +free handle image.handle +echo.passfail '${get:indent}${get:name}' 'fail - ${sts:} ${ret:}' +echo.passfail 'SUMMARY' 'fail' +setglobal '${arg:2}' 'fail' +return 'fail' +; +; Ruh-roh... +:MAIN.ERROR.FAIL +free handle image.handle +echo.passfail 'SUMMARY' 'fail' +setglobal '${arg:2}' 'fail' +return 'fail' diff --git a/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/SetCapabilities.tc b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/SetCapabilities.tc new file mode 100644 index 0000000..14178ee --- /dev/null +++ b/twaincs/source/twaincscert/source/data/certification/110 - Basic Printing Badge/SetCapabilities.tc @@ -0,0 +1,212 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; SetCapabilities +; Reset the driver's capabilites, and then set capabilities for this test. Note that one can only +; get this badge for the ADF. This is a production mode feature, so we're not testing the flatbed. +; Printing performs two main tasks: it endorses a sheet of paper to confirm it passed through the +; scanner, and the string printed on the sheet of paper may allow the user to find the corresponding +; image, if it's printed before the image is scanned. +; +; We follow the capability ordering: +; MSG_RESETALL +; set ICAP_XFERMECH.....................${arg:1} +; set CAP_FEEDERENABLED.................TRUE +; set CAP_XFERCOUNT.....................1 +; set ICAP_EXTIMAGEINFO.................TRUE +; set CAP_PRINTERENABLED................TRUE +; set CAP_PRINTER.......................TWPR_IMPRINTERTOPBEFORE, TWPR_IMPRINTERTOPAFTER, +; TWPR_IMPRINTERBOTTOMBEFORE,or TWPR_IMPRINTERBOTTOMAFTER +; set CAP_PRINTERMODE...................TWPM_COMPOUNDSTRING +; set CAP_PRINTERSTRING.................TWAIN +; set CAP_PRINTERINDEX..................TWAIN +; set CAP_PRINTERSUFFIX.................TWAIN +; set CAP_PRINTERVERTICALOFFSET.........set to its max value +; +; The test passes if all operations return TWRC_SUCCESS. +; +; Arguments +; arg:1 - TWSX_* value for ICAP_XFERMECH +; arg:2 - value of caller's indent +; arg:3 - global variable to store the CAP_PRINTER value +; +; Locals +; indent - indent the passfail text +; name - name of the current test +; twsx - TWSX_* value for ICAP_XFERMECH +; +; Returns +; pass or fail +; + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Initialize... +; +setlocal twsx '${arg:1}' +setlocal indent '${arg:2}' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; MSG_RESETALL +; If return code is not TWRC_SUCCESS, end with an error +; +setlocal name 'MSG_RESETALL' +dsmentry src ds dg_control dat_capability msg_resetall '0,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Set ICAP_XFERMECH... +; +setlocal name 'ICAP_XFERMECH MSG_SET TWSX_NATIVE' +dsmentry src ds dg_control dat_capability msg_set 'ICAP_XFERMECH,TWON_ONEVALUE,TWTY_UINT16,${get:twsx}' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Set CAP_FEEDERENABLED to TRUE +; +setlocal name 'CAP_FEEDERENABLED MSG_SET TRUE' +dsmentry src ds dg_control dat_capability msg_set 'CAP_FEEDERENABLED,TWON_ONEVALUE,TWTY_BOOL,TRUE' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Set CAP_XFERCOUNT to 1 +; +setlocal name 'CAP_XFERCOUNT MSG_SET 1' +dsmentry src ds dg_control dat_capability msg_set 'CAP_XFERCOUNT,TWON_ONEVALUE,TWTY_INT16,1' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Set ICAP_EXTIMAGEINFO to TRUE +; +setlocal name 'ICAP_EXTIMAGEINFO MSG_SET TRUE' +dsmentry src ds dg_control dat_capability msg_set 'ICAP_EXTIMAGEINFO,TWON_ONEVALUE,TWTY_BOOL,TRUE' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_PRINTERENABLED must currently be FALSE +; +setlocal name 'CAP_PRINTERENBLED resets to FALSE' +dsmentry src ds dg_control dat_capability msg_getcurrent 'CAP_PRINTERENABLED,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +if '${ret:},' !~contains ',FALSE,' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_PRINTERENABLED set to TRUE +; +setlocal name 'CAP_PRINTERENBLED set to TRUE' +dsmentry src ds dg_control dat_capability msg_set 'CAP_PRINTERENABLED,TWON_ONEVALUE,TWTY_BOOL,TRUE' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +dsmentry src ds dg_control dat_capability msg_getcurrent 'CAP_PRINTERENABLED,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +if '${ret:},' !~contains ',TRUE,' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_PRINTER must be supported with at least one of the printer values, +; squirrel away the value in the global argument stored in ${arg:3} +; +setlocal name 'CAP_PRINTER is supported' +dsmentry src ds dg_control dat_capability msg_getcurrent 'CAP_PRINTER,0,0,0' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +if '${ret:},' ~contains ',TWPR_IMPRINTERTOPBEFORE,' goto MAIN.PRINTER.PASS +if '${ret:},' ~contains ',TWPR_IMPRINTERTOPAFTER,' goto MAIN.PRINTER.PASS +if '${ret:},' ~contains ',TWPR_IMPRINTERBOTTOMBEFORE,' goto MAIN.PRINTER.PASS +if '${ret:},' ~contains ',TWPR_IMPRINTERBOTTOMAFTER,' goto MAIN.PRINTER.PASS +goto MAIN.ERROR.ECHOPASSFAIL +; +; Save the value so we can set it later... +:MAIN.PRINTER.PASS +setglobal ${arg:3} ${ret:${get:TW_ONEVALUE.Item}} +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_PRINTERMODE must be supported, and allow TWPM_COMPOUNDSTRING +; +setlocal name 'CAP_PRINTERMODE is supported' +dsmentry src ds dg_control dat_capability msg_set 'CAP_PRINTERMODE,TWON_ONEVALUE,TWTY_UINT16,TWPM_COMPOUNDSTRING' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_PRINTERSTRING must be supported, and allow setting to 'TWAIN'... +; +setlocal name 'CAP_PRINTERSTRING is supported' +dsmentry src ds dg_control dat_capability msg_set 'CAP_PRINTERSTRING,TWON_ONEVALUE,TWTY_STR255,TWAIN' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_PRINTERINDEX must be supported, and allow setting to 1... +; +setlocal name 'CAP_PRINTERINDEX is supported' +dsmentry src ds dg_control dat_capability msg_set 'CAP_PRINTERINDEX,TWON_ONEVALUE,TWTY_UINT32,1' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_PRINTERSUFFIX must be supported, and allow setting to 'TEST'... +; +setlocal name 'CAP_PRINTERSUFFIX is supported' +dsmentry src ds dg_control dat_capability msg_getcurrent 'CAP_PRINTERSUFFIX,TWON_ONEVALUE,TWTY_STR255,TEST' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CAP_PRINTERVERTICALOFFSET must be supported, and allow setting to the current value... +; +setlocal name 'CAP_PRINTERVERTICALOFFSET is supported' +dsmentry src ds dg_control dat_capability msg_getcurrent 'CAP_PRINTERVERTICALOFFSET' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +dsmentry src ds dg_control dat_capability msg_set 'CAP_PRINTERVERTICALOFFSET,TWON_ONEVALUE,TWTY_FIX32,${ret:${get:TW_ONEVALUE.Item}}' +if '${sts:}' != 'SUCCESS' goto MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'pass' + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Summary and cleanup... +; +; Did we pass? +:MAIN.PASS +return 'pass' +; +; Skip this item... +:MAIN.SKIP +echo.passfail '${get:name}' 'skip - ${sts:} ${ret:}' +return 'skip' +; +; Ruh-roh... +:MAIN.ERROR.ECHOPASSFAIL +echo.passfail '${get:indent}${get:name}' 'fail - ${sts:} ${ret:}' +return 'fail' diff --git a/twaincs/source/twaincscert/source/terminal.cs b/twaincs/source/twaincscert/source/terminal.cs index 292a3b4..284b553 100644 --- a/twaincs/source/twaincscert/source/terminal.cs +++ b/twaincs/source/twaincscert/source/terminal.cs @@ -2189,6 +2189,10 @@ private bool CmdHelp(ref Interpreter.FunctionArguments a_functionarguments) Display(" '${getindex:target:index}'"); Display(" Runs the target through CSV and returns the item at the requested index."); Display(""); + Display(" '${gettwei:twei:target}'"); + Display(" Look up a TWEI value in TWAINH.CS (ex: ${gettwei:TWEI_PIXELFLAVOR:TWPF_CHOCOLATE}. This"); + Display(" is useful when processing data returned by DAT_EXTIMAGEINFO."); + Display(""); Display(" '${localtime:[format]}'"); Display(" Returns the current local time using the DateTime format."); Display(""); @@ -5315,6 +5319,7 @@ private void Expansion(Interpreter.FunctionArguments a_functionarguments, ref st || szSymbol.StartsWith("${folder:") || szSymbol.StartsWith("${format:") || szSymbol.StartsWith("${get:") + || szSymbol.StartsWith("${gettwei:") || szSymbol.StartsWith("${gethandle:") || szSymbol.StartsWith("${gethandleindex:") || szSymbol.StartsWith("${getindex:") @@ -5644,12 +5649,32 @@ private void Expansion(Interpreter.FunctionArguments a_functionarguments, ref st szValue = BitConverter.ToUInt64(abValue, 0).ToString(); break; case "TWTY_STR32": + szValue = ""; + iDataBytes = Marshal.SizeOf(typeof(TWAIN.TW_STR32)); + abValue = new byte[iDataBytes]; + Marshal.Copy(intptrPointer, abValue, 0, iDataBytes); + szValue = Encoding.UTF8.GetString(abValue).Replace("\0", ""); break; case "TWTY_STR64": + szValue = ""; + iDataBytes = Marshal.SizeOf(typeof(TWAIN.TW_STR64)); + abValue = new byte[iDataBytes]; + Marshal.Copy(intptrPointer, abValue, 0, iDataBytes); + szValue = Encoding.UTF8.GetString(abValue).Replace("\0", ""); break; case "TWTY_STR128": + szValue = ""; + iDataBytes = Marshal.SizeOf(typeof(TWAIN.TW_STR128)); + abValue = new byte[iDataBytes]; + Marshal.Copy(intptrPointer, abValue, 0, iDataBytes); + szValue = Encoding.UTF8.GetString(abValue).Replace("\0", ""); break; case "TWTY_STR255": + szValue = ""; + iDataBytes = Marshal.SizeOf(typeof(TWAIN.TW_STR255)); + abValue = new byte[iDataBytes]; + Marshal.Copy(intptrPointer, abValue, 0, iDataBytes); + szValue = Encoding.UTF8.GetString(abValue).Replace("\0",""); break; case "TWTY_HANDLE": szValue = ""; @@ -5806,6 +5831,25 @@ private void Expansion(Interpreter.FunctionArguments a_functionarguments, ref st } } + // Look up an enum value from TWAINH.CS... + else if (szSymbol.StartsWith("${gettwei:")) + { + TWAIN.TWEI twei; + + // Strip off ${...} + string szGetTwei = szSymbol.Substring(0, szSymbol.Length - 1).Substring(10); + string[] aszGetTwei = szGetTwei.Split(':'); + + // Do the lookup... + if (aszGetTwei.Length > 1) + { + if (Enum.TryParse(aszGetTwei[0].Replace("TWEI_","").Replace("twei_",""), out twei)) + { + szValue = TWAIN.CvtTweiValueToEnum(twei, aszGetTwei[1]); + } + } + } + // Access to the local time... else if (szSymbol.StartsWith("${localtime:")) {