diff --git a/Sanity/basic-sanity/example-std.ps b/Sanity/basic-sanity/example-std.ps new file mode 100644 index 0000000..5938dc8 --- /dev/null +++ b/Sanity/basic-sanity/example-std.ps @@ -0,0 +1,526 @@ +%!PS-Adobe-3.0 +%%BoundingBox: 38 24 574 768 +%%Title: Enscript Output +%%For: root +%%Creator: GNU Enscript 1.6.6 +%%CreationDate: Mon May 15 06:07:28 2023 +%%Orientation: Portrait +%%Pages: (atend) +%%DocumentMedia: Letter 612 792 0 () () +%%DocumentNeededResources: (atend) +%%EndComments +%%BeginProlog +%%BeginResource: procset Enscript-Prolog 1.6 6 +% +% Procedures. +% + +/_S { % save current state + /_s save def +} def +/_R { % restore from saved state + _s restore +} def + +/S { % showpage protecting gstate + gsave + showpage + grestore +} bind def + +/MF { % fontname newfontname -> - make a new encoded font + /newfontname exch def + /fontname exch def + + /fontdict fontname findfont def + /newfont fontdict maxlength dict def + + fontdict { + exch + dup /FID eq { + % skip FID pair + pop pop + } { + % copy to the new font dictionary + exch newfont 3 1 roll put + } ifelse + } forall + + newfont /FontName newfontname put + + % insert only valid encoding vectors + encoding_vector length 256 eq { + newfont /Encoding encoding_vector put + } if + + newfontname newfont definefont pop +} def + +/MF_PS { % fontname newfontname -> - make a new font preserving its enc + /newfontname exch def + /fontname exch def + + /fontdict fontname findfont def + /newfont fontdict maxlength dict def + + fontdict { + exch + dup /FID eq { + % skip FID pair + pop pop + } { + % copy to the new font dictionary + exch newfont 3 1 roll put + } ifelse + } forall + + newfont /FontName newfontname put + + newfontname newfont definefont pop +} def + +/SF { % fontname width height -> - set a new font + /height exch def + /width exch def + + findfont + [width 0 0 height 0 0] makefont setfont +} def + +/SUF { % fontname width height -> - set a new user font + /height exch def + /width exch def + + /F-gs-user-font MF + /F-gs-user-font width height SF +} def + +/SUF_PS { % fontname width height -> - set a new user font preserving its enc + /height exch def + /width exch def + + /F-gs-user-font MF_PS + /F-gs-user-font width height SF +} def + +/M {moveto} bind def +/s {show} bind def + +/Box { % x y w h -> - define box path + /d_h exch def /d_w exch def /d_y exch def /d_x exch def + d_x d_y moveto + d_w 0 rlineto + 0 d_h rlineto + d_w neg 0 rlineto + closepath +} def + +/bgs { % x y height blskip gray str -> - show string with bg color + /str exch def + /gray exch def + /blskip exch def + /height exch def + /y exch def + /x exch def + + gsave + x y blskip sub str stringwidth pop height Box + gray setgray + fill + grestore + x y M str s +} def + +/bgcs { % x y height blskip red green blue str -> - show string with bg color + /str exch def + /blue exch def + /green exch def + /red exch def + /blskip exch def + /height exch def + /y exch def + /x exch def + + gsave + x y blskip sub str stringwidth pop height Box + red green blue setrgbcolor + fill + grestore + x y M str s +} def + +% Highlight bars. +/highlight_bars { % nlines lineheight output_y_margin gray -> - + gsave + setgray + /ymarg exch def + /lineheight exch def + /nlines exch def + + % This 2 is just a magic number to sync highlight lines to text. + 0 d_header_y ymarg sub 2 sub translate + + /cw d_output_w cols div def + /nrows d_output_h ymarg 2 mul sub lineheight div cvi def + + % for each column + 0 1 cols 1 sub { + cw mul /xp exch def + + % for each rows + 0 1 nrows 1 sub { + /rn exch def + rn lineheight mul neg /yp exch def + rn nlines idiv 2 mod 0 eq { + % Draw highlight bar. 4 is just a magic indentation. + xp 4 add yp cw 8 sub lineheight neg Box fill + } if + } for + } for + + grestore +} def + +% Line highlight bar. +/line_highlight { % x y width height gray -> - + gsave + /gray exch def + Box gray setgray fill + grestore +} def + +% Column separator lines. +/column_lines { + gsave + .1 setlinewidth + 0 d_footer_h translate + /cw d_output_w cols div def + 1 1 cols 1 sub { + cw mul 0 moveto + 0 d_output_h rlineto stroke + } for + grestore +} def + +% Column borders. +/column_borders { + gsave + .1 setlinewidth + 0 d_footer_h moveto + 0 d_output_h rlineto + d_output_w 0 rlineto + 0 d_output_h neg rlineto + closepath stroke + grestore +} def + +% Do the actual underlay drawing +/draw_underlay { + ul_style 0 eq { + ul_str true charpath stroke + } { + ul_str show + } ifelse +} def + +% Underlay +/underlay { % - -> - + gsave + 0 d_page_h translate + d_page_h neg d_page_w atan rotate + + ul_gray setgray + ul_font setfont + /dw d_page_h dup mul d_page_w dup mul add sqrt def + ul_str stringwidth pop dw exch sub 2 div ul_h_ptsize -2 div moveto + draw_underlay + grestore +} def + +/user_underlay { % - -> - + gsave + ul_x ul_y translate + ul_angle rotate + ul_gray setgray + ul_font setfont + 0 0 ul_h_ptsize 2 div sub moveto + draw_underlay + grestore +} def + +% Page prefeed +/page_prefeed { % bool -> - + statusdict /prefeed known { + statusdict exch /prefeed exch put + } { + pop + } ifelse +} def + +% Wrapped line markers +/wrapped_line_mark { % x y charwith charheight type -> - + /type exch def + /h exch def + /w exch def + /y exch def + /x exch def + + type 2 eq { + % Black boxes (like TeX does) + gsave + 0 setlinewidth + x w 4 div add y M + 0 h rlineto w 2 div 0 rlineto 0 h neg rlineto + closepath fill + grestore + } { + type 3 eq { + % Small arrows + gsave + .2 setlinewidth + x w 2 div add y h 2 div add M + w 4 div 0 rlineto + x w 4 div add y lineto stroke + + x w 4 div add w 8 div add y h 4 div add M + x w 4 div add y lineto + w 4 div h 8 div rlineto stroke + grestore + } { + % do nothing + } ifelse + } ifelse +} def + +% EPSF import. + +/BeginEPSF { + /b4_Inc_state save def % Save state for cleanup + /dict_count countdictstack def % Count objects on dict stack + /op_count count 1 sub def % Count objects on operand stack + userdict begin + /showpage { } def + 0 setgray 0 setlinecap + 1 setlinewidth 0 setlinejoin + 10 setmiterlimit [ ] 0 setdash newpath + /languagelevel where { + pop languagelevel + 1 ne { + false setstrokeadjust false setoverprint + } if + } if +} bind def + +/EndEPSF { + count op_count sub { pos } repeat % Clean up stacks + countdictstack dict_count sub { end } repeat + b4_Inc_state restore +} bind def + +% Check PostScript language level. +/languagelevel where { + pop /gs_languagelevel languagelevel def +} { + /gs_languagelevel 1 def +} ifelse +%%EndResource +%%BeginResource: procset Enscript-Encoding-88591 1.6 6 +/encoding_vector [ +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/space /exclam /quotedbl /numbersign +/dollar /percent /ampersand /quoteright +/parenleft /parenright /asterisk /plus +/comma /hyphen /period /slash +/zero /one /two /three +/four /five /six /seven +/eight /nine /colon /semicolon +/less /equal /greater /question +/at /A /B /C +/D /E /F /G +/H /I /J /K +/L /M /N /O +/P /Q /R /S +/T /U /V /W +/X /Y /Z /bracketleft +/backslash /bracketright /asciicircum /underscore +/quoteleft /a /b /c +/d /e /f /g +/h /i /j /k +/l /m /n /o +/p /q /r /s +/t /u /v /w +/x /y /z /braceleft +/bar /braceright /tilde /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/space /exclamdown /cent /sterling +/currency /yen /brokenbar /section +/dieresis /copyright /ordfeminine /guillemotleft +/logicalnot /hyphen /registered /macron +/degree /plusminus /twosuperior /threesuperior +/acute /mu /paragraph /bullet +/cedilla /onesuperior /ordmasculine /guillemotright +/onequarter /onehalf /threequarters /questiondown +/Agrave /Aacute /Acircumflex /Atilde +/Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis +/Igrave /Iacute /Icircumflex /Idieresis +/Eth /Ntilde /Ograve /Oacute +/Ocircumflex /Otilde /Odieresis /multiply +/Oslash /Ugrave /Uacute /Ucircumflex +/Udieresis /Yacute /Thorn /germandbls +/agrave /aacute /acircumflex /atilde +/adieresis /aring /ae /ccedilla +/egrave /eacute /ecircumflex /edieresis +/igrave /iacute /icircumflex /idieresis +/eth /ntilde /ograve /oacute +/ocircumflex /otilde /odieresis /divide +/oslash /ugrave /uacute /ucircumflex +/udieresis /yacute /thorn /ydieresis +] def +%%EndResource +%%EndProlog +%%BeginSetup +%%IncludeResource: font Courier-Bold +%%IncludeResource: font Courier +/HFpt_w 10 def +/HFpt_h 10 def +/Courier-Bold /HF-gs-font MF +/HF /HF-gs-font findfont [HFpt_w 0 0 HFpt_h 0 0] makefont def +/Courier /F-gs-font MF +/F-gs-font 10 10 SF +/#copies 1 def +% Pagedevice definitions: +gs_languagelevel 1 gt { + << + /PageSize [612 792] + >> setpagedevice +} if +%%BeginResource: procset Enscript-Header-enscript 1.6 6 +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman + +% Fonts. +/Times-Bold /HeaderFont-Bold MF +/HeaderDateF /HeaderFont-Bold findfont 12 scalefont def + +/Times-Roman /HeaderFont-Times MF +/HeaderHDRF /HeaderFont-Times findfont 14 scalefont def + +/HeaderPageNumF /Helvetica-Bold findfont 28.8 scalefont def + +/do_header { % print enscript header + gsave + d_header_x d_header_y translate + + % light bar + 0 0 d_header_w d_header_h 2 div Box + .95 setgray fill + + % dark gray boxes + /dbw d_header_h 2 mul def % dark box width + /dbc .7 def % dark box color + + % left dark box. + 0 0 dbw d_header_h Box + dbc setgray fill + + 0 setgray + HeaderDateF setfont + moddatestr dup stringwidth pop dbw exch sub 2 div + d_header_h 2 div 2 add moveto show + modtimestr dup stringwidth pop dbw exch sub 2 div + d_header_h 5 div moveto show + + % right dark box + d_header_w dbw sub 0 dbw d_header_h Box + dbc setgray fill + + HeaderPageNumF setfont + 1 setgray + pagenumstr dup + stringwidth pop dbw exch sub 2 div d_header_w dbw sub add + d_header_h .2 mul moveto show + + % filename + 0 setgray + HeaderHDRF setfont + d_header_w fname stringwidth pop sub 2 div d_header_h 8 div moveto + fname show + + % user supplied header string. + user_header_p { + /h d_header_h 8 div 5 mul def + + % Implement strict enscript compatibility. + user_header_center_str () eq user_header_right_str () eq and { + d_header_w user_header_left_str stringwidth pop sub 2 div + h moveto user_header_left_str show + } { + dbw 5 add h moveto user_header_left_str show + + d_header_w user_header_center_str stringwidth pop sub 2 div + h moveto user_header_center_str show + + d_header_w dbw sub 5 sub user_header_right_str stringwidth pop + sub h moveto user_header_right_str show + } ifelse + } if + + grestore +} def +%%EndResource +/d_page_w 536 def +/d_page_h 744 def +/d_header_x 0 def +/d_header_y 708 def +/d_header_w 536 def +/d_header_h 36 def +/d_footer_x 0 def +/d_footer_y 0 def +/d_footer_w 536 def +/d_footer_h 0 def +/d_output_w 536 def +/d_output_h 708 def +/cols 2 def +%%EndSetup +%%Page: (1) 1 +%%BeginPageSetup +_S +38 24 translate +/pagenum 1 def +/fname (testfile.txt) def +/fdir (.) def +/ftail (testfile.txt) def +% User defined strings: +/pagenumstr (1) def +/moddatestr (05/15/23) def +/modtimestr (05:15:54) def +/user_header_p false def +/user_footer_p false def +%%EndPageSetup +column_lines +do_header +58.3465 695 M (1:) s +76.3465 695 M +(The test tests this test text. ) s +_R +S +%%Trailer +%%Pages: 1 +%%DocumentNeededResources: font Times-Roman Courier-Bold Courier +%%+ font Times-Bold +%%EOF diff --git a/Sanity/basic-sanity/example.ansi b/Sanity/basic-sanity/example.ansi new file mode 100644 index 0000000..cc5e878 --- /dev/null +++ b/Sanity/basic-sanity/example.ansi @@ -0,0 +1,2 @@ +The test tests this test text. + \ No newline at end of file diff --git a/Sanity/basic-sanity/example.html b/Sanity/basic-sanity/example.html new file mode 100644 index 0000000..a45331b --- /dev/null +++ b/Sanity/basic-sanity/example.html @@ -0,0 +1,22 @@ + + + +Enscript Output + + + +

Contents

+
    +
  1. testfile.txt +
+
+ +

testfile.txt

+ +
+The test tests this test text. 
+
+
+
Generated by GNU Enscript 1.6.6.
+ + diff --git a/Sanity/basic-sanity/example.ps b/Sanity/basic-sanity/example.ps new file mode 100644 index 0000000..2ab192d --- /dev/null +++ b/Sanity/basic-sanity/example.ps @@ -0,0 +1,488 @@ +%!PS-Adobe-3.0 +%%BoundingBox: 38 24 574 768 +%%Title: Enscript Output +%%For: root +%%Creator: GNU Enscript 1.6.6 +%%CreationDate: Mon May 15 05:56:28 2023 +%%Orientation: Portrait +%%Pages: (atend) +%%DocumentMedia: Letter 612 792 0 () () +%%DocumentNeededResources: (atend) +%%EndComments +%%BeginProlog +%%BeginResource: procset Enscript-Prolog 1.6 6 +% +% Procedures. +% + +/_S { % save current state + /_s save def +} def +/_R { % restore from saved state + _s restore +} def + +/S { % showpage protecting gstate + gsave + showpage + grestore +} bind def + +/MF { % fontname newfontname -> - make a new encoded font + /newfontname exch def + /fontname exch def + + /fontdict fontname findfont def + /newfont fontdict maxlength dict def + + fontdict { + exch + dup /FID eq { + % skip FID pair + pop pop + } { + % copy to the new font dictionary + exch newfont 3 1 roll put + } ifelse + } forall + + newfont /FontName newfontname put + + % insert only valid encoding vectors + encoding_vector length 256 eq { + newfont /Encoding encoding_vector put + } if + + newfontname newfont definefont pop +} def + +/MF_PS { % fontname newfontname -> - make a new font preserving its enc + /newfontname exch def + /fontname exch def + + /fontdict fontname findfont def + /newfont fontdict maxlength dict def + + fontdict { + exch + dup /FID eq { + % skip FID pair + pop pop + } { + % copy to the new font dictionary + exch newfont 3 1 roll put + } ifelse + } forall + + newfont /FontName newfontname put + + newfontname newfont definefont pop +} def + +/SF { % fontname width height -> - set a new font + /height exch def + /width exch def + + findfont + [width 0 0 height 0 0] makefont setfont +} def + +/SUF { % fontname width height -> - set a new user font + /height exch def + /width exch def + + /F-gs-user-font MF + /F-gs-user-font width height SF +} def + +/SUF_PS { % fontname width height -> - set a new user font preserving its enc + /height exch def + /width exch def + + /F-gs-user-font MF_PS + /F-gs-user-font width height SF +} def + +/M {moveto} bind def +/s {show} bind def + +/Box { % x y w h -> - define box path + /d_h exch def /d_w exch def /d_y exch def /d_x exch def + d_x d_y moveto + d_w 0 rlineto + 0 d_h rlineto + d_w neg 0 rlineto + closepath +} def + +/bgs { % x y height blskip gray str -> - show string with bg color + /str exch def + /gray exch def + /blskip exch def + /height exch def + /y exch def + /x exch def + + gsave + x y blskip sub str stringwidth pop height Box + gray setgray + fill + grestore + x y M str s +} def + +/bgcs { % x y height blskip red green blue str -> - show string with bg color + /str exch def + /blue exch def + /green exch def + /red exch def + /blskip exch def + /height exch def + /y exch def + /x exch def + + gsave + x y blskip sub str stringwidth pop height Box + red green blue setrgbcolor + fill + grestore + x y M str s +} def + +% Highlight bars. +/highlight_bars { % nlines lineheight output_y_margin gray -> - + gsave + setgray + /ymarg exch def + /lineheight exch def + /nlines exch def + + % This 2 is just a magic number to sync highlight lines to text. + 0 d_header_y ymarg sub 2 sub translate + + /cw d_output_w cols div def + /nrows d_output_h ymarg 2 mul sub lineheight div cvi def + + % for each column + 0 1 cols 1 sub { + cw mul /xp exch def + + % for each rows + 0 1 nrows 1 sub { + /rn exch def + rn lineheight mul neg /yp exch def + rn nlines idiv 2 mod 0 eq { + % Draw highlight bar. 4 is just a magic indentation. + xp 4 add yp cw 8 sub lineheight neg Box fill + } if + } for + } for + + grestore +} def + +% Line highlight bar. +/line_highlight { % x y width height gray -> - + gsave + /gray exch def + Box gray setgray fill + grestore +} def + +% Column separator lines. +/column_lines { + gsave + .1 setlinewidth + 0 d_footer_h translate + /cw d_output_w cols div def + 1 1 cols 1 sub { + cw mul 0 moveto + 0 d_output_h rlineto stroke + } for + grestore +} def + +% Column borders. +/column_borders { + gsave + .1 setlinewidth + 0 d_footer_h moveto + 0 d_output_h rlineto + d_output_w 0 rlineto + 0 d_output_h neg rlineto + closepath stroke + grestore +} def + +% Do the actual underlay drawing +/draw_underlay { + ul_style 0 eq { + ul_str true charpath stroke + } { + ul_str show + } ifelse +} def + +% Underlay +/underlay { % - -> - + gsave + 0 d_page_h translate + d_page_h neg d_page_w atan rotate + + ul_gray setgray + ul_font setfont + /dw d_page_h dup mul d_page_w dup mul add sqrt def + ul_str stringwidth pop dw exch sub 2 div ul_h_ptsize -2 div moveto + draw_underlay + grestore +} def + +/user_underlay { % - -> - + gsave + ul_x ul_y translate + ul_angle rotate + ul_gray setgray + ul_font setfont + 0 0 ul_h_ptsize 2 div sub moveto + draw_underlay + grestore +} def + +% Page prefeed +/page_prefeed { % bool -> - + statusdict /prefeed known { + statusdict exch /prefeed exch put + } { + pop + } ifelse +} def + +% Wrapped line markers +/wrapped_line_mark { % x y charwith charheight type -> - + /type exch def + /h exch def + /w exch def + /y exch def + /x exch def + + type 2 eq { + % Black boxes (like TeX does) + gsave + 0 setlinewidth + x w 4 div add y M + 0 h rlineto w 2 div 0 rlineto 0 h neg rlineto + closepath fill + grestore + } { + type 3 eq { + % Small arrows + gsave + .2 setlinewidth + x w 2 div add y h 2 div add M + w 4 div 0 rlineto + x w 4 div add y lineto stroke + + x w 4 div add w 8 div add y h 4 div add M + x w 4 div add y lineto + w 4 div h 8 div rlineto stroke + grestore + } { + % do nothing + } ifelse + } ifelse +} def + +% EPSF import. + +/BeginEPSF { + /b4_Inc_state save def % Save state for cleanup + /dict_count countdictstack def % Count objects on dict stack + /op_count count 1 sub def % Count objects on operand stack + userdict begin + /showpage { } def + 0 setgray 0 setlinecap + 1 setlinewidth 0 setlinejoin + 10 setmiterlimit [ ] 0 setdash newpath + /languagelevel where { + pop languagelevel + 1 ne { + false setstrokeadjust false setoverprint + } if + } if +} bind def + +/EndEPSF { + count op_count sub { pos } repeat % Clean up stacks + countdictstack dict_count sub { end } repeat + b4_Inc_state restore +} bind def + +% Check PostScript language level. +/languagelevel where { + pop /gs_languagelevel languagelevel def +} { + /gs_languagelevel 1 def +} ifelse +%%EndResource +%%BeginResource: procset Enscript-Encoding-88591 1.6 6 +/encoding_vector [ +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/space /exclam /quotedbl /numbersign +/dollar /percent /ampersand /quoteright +/parenleft /parenright /asterisk /plus +/comma /hyphen /period /slash +/zero /one /two /three +/four /five /six /seven +/eight /nine /colon /semicolon +/less /equal /greater /question +/at /A /B /C +/D /E /F /G +/H /I /J /K +/L /M /N /O +/P /Q /R /S +/T /U /V /W +/X /Y /Z /bracketleft +/backslash /bracketright /asciicircum /underscore +/quoteleft /a /b /c +/d /e /f /g +/h /i /j /k +/l /m /n /o +/p /q /r /s +/t /u /v /w +/x /y /z /braceleft +/bar /braceright /tilde /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef +/space /exclamdown /cent /sterling +/currency /yen /brokenbar /section +/dieresis /copyright /ordfeminine /guillemotleft +/logicalnot /hyphen /registered /macron +/degree /plusminus /twosuperior /threesuperior +/acute /mu /paragraph /bullet +/cedilla /onesuperior /ordmasculine /guillemotright +/onequarter /onehalf /threequarters /questiondown +/Agrave /Aacute /Acircumflex /Atilde +/Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis +/Igrave /Iacute /Icircumflex /Idieresis +/Eth /Ntilde /Ograve /Oacute +/Ocircumflex /Otilde /Odieresis /multiply +/Oslash /Ugrave /Uacute /Ucircumflex +/Udieresis /Yacute /Thorn /germandbls +/agrave /aacute /acircumflex /atilde +/adieresis /aring /ae /ccedilla +/egrave /eacute /ecircumflex /edieresis +/igrave /iacute /icircumflex /idieresis +/eth /ntilde /ograve /oacute +/ocircumflex /otilde /odieresis /divide +/oslash /ugrave /uacute /ucircumflex +/udieresis /yacute /thorn /ydieresis +] def +%%EndResource +%%EndProlog +%%BeginSetup +%%IncludeResource: font Times-Roman +%%IncludeResource: font Courier-Bold +/HFpt_w 10 def +/HFpt_h 10 def +/Courier-Bold /HF-gs-font MF +/HF /HF-gs-font findfont [HFpt_w 0 0 HFpt_h 0 0] makefont def +/Times-Roman /F-gs-font MF +/F-gs-font 22 22 SF +/#copies 1 def +% Pagedevice definitions: +gs_languagelevel 1 gt { + << + /PageSize [612 792] + >> setpagedevice +} if +%%BeginResource: procset Enscript-Header-simple 1.6 6 + +/do_header { % print default simple header + gsave + d_header_x d_header_y HFpt_h 3 div add translate + + HF setfont + user_header_p { + 5 0 moveto user_header_left_str show + + d_header_w user_header_center_str stringwidth pop sub 2 div + 0 moveto user_header_center_str show + + d_header_w user_header_right_str stringwidth pop sub 5 sub + 0 moveto user_header_right_str show + } { + fname length fmodstr length add pagenumstr length add 95 6 idiv add d_header_w 6 idiv le{ + 5 0 moveto fname show + 45 0 rmoveto fmodstr show + 45 0 rmoveto pagenumstr show + } { + 5 0 moveto fmodstr show + 45 0 rmoveto pagenumstr show + fname length d_header_w 6 idiv idiv 1 add 10 mul 5 exch moveto + 1 1 fname length d_header_w 6 idiv idiv + { + dup fname exch 1 sub d_header_w 6 idiv mul d_header_w 6 idiv getinterval show + 5 exch 10 mul fname length d_header_w 6 idiv idiv 1 add 10 mul exch sub moveto + } for + 5 10 moveto + fname fname length d_header_w 6 idiv idiv d_header_w 6 idiv mul dup fname length exch sub getinterval show + }ifelse + }ifelse + + grestore +} def +%%EndResource +/d_page_w 536 def +/d_page_h 744 def +/d_header_x 0 def +/d_header_y 700 def +/d_header_w 536 def +/d_header_h 44 def +/d_footer_x 0 def +/d_footer_y 0 def +/d_footer_w 536 def +/d_footer_h 0 def +/d_output_w 536 def +/d_output_h 700 def +/cols 1 def +%%EndSetup +%%Page: (1) 1 +%%BeginPageSetup +_S +38 24 translate +/pagenum 1 def +/fname (testfile.txt) def +/fdir (.) def +/ftail (testfile.txt) def +% User defined strings: +/fmodstr (Mon May 15 05:15:54 2023) def +/pagenumstr (1) def +/user_header_p true def +/user_header_left_str (05/15/23 Page 1 of 1) def +/user_header_center_str () def +/user_header_right_str () def +/user_footer_p false def +%%EndPageSetup +do_header +5 675 M +(The test tests this test text. ) s +_R +S +%%Trailer +%%Pages: 1 +%%DocumentNeededResources: font Times-Roman Courier-Bold +%%EOF diff --git a/Sanity/basic-sanity/example.rtf b/Sanity/basic-sanity/example.rtf new file mode 100644 index 0000000..c9449b9 --- /dev/null +++ b/Sanity/basic-sanity/example.rtf @@ -0,0 +1,5 @@ +{\rtf\ansi\deff0 +{\fonttbl{\f0\fswiss Courier New;}} +{\colortbl;\red0\green0\blue0;\red64\green64\blue64;\red127\green127\blue127;\red191\green191\blue191;\red217\green217\blue217;\red229\green229\blue229;\red242\green242\blue242;\red0\green0\blue255;\red95\green158\blue160;\red184\green134\blue11;\red85\green107\blue47;\red178\green34\blue34;\red34\green139\blue34;\red0\green255\blue0;\red218\green112\blue214;\red160\green32\blue240;\red255\green0\blue0;\red188\green143\blue143;\red143\green188\blue143;\red193\green255\blue193;\red180\green238\blue180;\red155\green205\blue155;\red105\green139\blue105;\red237\green218\blue116;\red67\green183\blue186;\red100\green233\blue134;\red247\green101\blue65;\red154\green254\blue255;\red211\green211\blue211;} +The test tests this test text. \line +} diff --git a/Sanity/basic-sanity/main.fmf b/Sanity/basic-sanity/main.fmf new file mode 100644 index 0000000..b7517a2 --- /dev/null +++ b/Sanity/basic-sanity/main.fmf @@ -0,0 +1,23 @@ +summary: Basic sanity test +description: basic-sanity +contact: Ondrej Mejzlik +test: ./runtest.sh +framework: beakerlib +duration: 5m +enabled: true +tag: + - NoRHEL6 + - NoRHEL7 +adjust: + - enabled: false + when: distro < rhel-7 + continue: false + - enabled: false + when: distro == rhel-alt-7 + continue: false +component: + - enscript +recommend: + - enscript +extra-nitrate: TC#0615280 +id: 0b37e655-52ab-4989-9477-1fd2f55f3b47 diff --git a/Sanity/basic-sanity/runtest.sh b/Sanity/basic-sanity/runtest.sh new file mode 100755 index 0000000..fee1dd7 --- /dev/null +++ b/Sanity/basic-sanity/runtest.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/enscript/Sanity/basic-sanity +# Description: Test for basic-sanity +# Author: Ondrej Mejzlik +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2023 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE=${PACKAGE:-enscript} + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE || rlDie "Package $PACKAGE not installed" + TESTDIR=$(pwd) + rlLog "Arch: $(arch), PC name: $(hostname), $(hostname -A) User: $(whoami)" + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" 0 "Going into tmp directory $TmpDir" + rlRun "cp $TESTDIR/testfile.txt ." 0 "Copy test file" + rlRun "cp $TESTDIR/example.ps ." 0 "Copy ps test file" + rlRun "cp $TESTDIR/example.html ." 0 "Copy html test file" + rlRun "cp $TESTDIR/example.rtf ." 0 "Copy rtf test file" + rlRun "cp $TESTDIR/example.ansi ." 0 "Copy ansi test file" + rlRun "cp $TESTDIR/example-std.ps ." 0 "Copy ansi test file" + rlPhaseEnd + + rlGetTestState && { + rlPhaseStartTest + rlRun "enscript -f 'Times-Roman22' --header '%W Page $% of $=' -p output.ps testfile.txt" 0 "Generate ps file" + rlRun "test $(diff example.ps output.ps | wc -l) -eq 8" 0 "Output diff has 8 lines, difference in date" + diff example.ps output.ps + + rlRun "enscript -E --color --toc -w html -p output.html testfile.txt" 0 "Generate html file" + rlRun "diff example.html output.html" 0 "HTML files should not differ" + diff example.html output.html + + rlRun "enscript -G2rE -U2 -w rtf -p output.rtf testfile.txt" 0 "Generate rtf file" + rlRun "diff example.rtf output.rtf" 0 "RTF files should not differ" + diff example.rtf output.rtf + + rlRun "enscript -DDuplex:true -Possu -w ansi -p output.ansi testfile.txt" 0 "Generate ansi file" + rlRun "diff example.ansi output.ansi" 0 "Ansi files should not differ" + diff example.ansi output.ansi + + rlRun "enscript --file-align=2 -2 -B -C -G -i 1c -p - testfile.txt > output-std.ps" 0 "Generate test ps file on std" + rlRun "test $(diff example-std.ps output-std.ps | wc -l) -eq 8" 0 "Output diff has 8 lines, difference in date" + diff example-std.ps output-std.ps + rlPhaseEnd + } + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Sanity/basic-sanity/testfile.txt b/Sanity/basic-sanity/testfile.txt new file mode 100644 index 0000000..45c7909 --- /dev/null +++ b/Sanity/basic-sanity/testfile.txt @@ -0,0 +1 @@ +The test tests this test text.