tb0045.pp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. { %GRAPH }
  2. { Old file: tbs0051.pp }
  3. { Graph, shows a problem with putpixel OK 0.99.9 (PM) }
  4. {$ifdef go32v2}
  5. {define has_colors_equal}
  6. {$endif go32v2}
  7. {$ifdef go32v2}
  8. {$define OK}
  9. {$endif}
  10. {$ifdef linux}
  11. {$define OK}
  12. {$endif}
  13. {$ifdef OK}
  14. uses crt,graph;
  15. {$ifndef has_colors_equal}
  16. function ColorsEqual(c1, c2 : longint) : boolean;
  17. begin
  18. ColorsEqual:=((GetMaxColor=$FF) and ((c1 and $FF)=(c2 and $FF))) or
  19. ((GetMaxColor=$7FFF) and ((c1 and $F8F8F8)=(c2 and $F8F8F8))) or
  20. ((GetMaxColor=$FFFF) and ((c1 and $F8FCF8)=(c2 and $F8FCF8))) or
  21. ((GetMaxColor>$10000) and ((c1 and $FFFFFF)=(c2 and $FFFFFF)));
  22. end;
  23. {$endif not has_colors_equal}
  24. var gd,gm,gError,yi,i : integer;
  25. col: longint;
  26. error : word;
  27. {$endif OK}
  28. BEGIN
  29. {$ifdef OK}
  30. if paramcount=0 then
  31. gm:=$111 {640x480/64K HiColor}
  32. else
  33. begin
  34. val(paramstr(1),gm,error);
  35. if error<>0 then
  36. gm:=$111;
  37. end;
  38. gd:=detect;
  39. InitGraph(gd,gm,'');
  40. gError := graphResult;
  41. IF gError <> grOk
  42. THEN begin
  43. writeln ('graphDriver=',gd,' graphMode=',gm,
  44. #13#10'Graphics error: ',gError);
  45. halt(1);
  46. end;
  47. for i := 0 to 255
  48. do begin
  49. { new grpah unit used word type for colors }
  50. col := {i shl 16 + }(i) shl 8 + (i div 2);
  51. for yi := 0 to 20 do
  52. PutPixel (i,yi,col);
  53. SetColor (col);
  54. Line (i,22,i,42);
  55. end;
  56. for i:=0 to 255 do
  57. if not ColorsEqual(getpixel(i,15),getpixel(i,30)) then
  58. Halt(1);
  59. {readkey;}delay(1000);
  60. closegraph;
  61. {$endif OK}
  62. END.
  63. {
  64. $Log$
  65. Revision 1.1 2000-11-30 22:38:17 peter
  66. * renamed test suite
  67. Revision 1.1 2000/11/29 23:14:15 peter
  68. * new testsuite setup
  69. Revision 1.1 2000/07/13 09:21:54 michael
  70. + Initial import
  71. Revision 1.2 2000/04/14 05:44:22 pierre
  72. * adapted to new graph unit
  73. Revision 1.1 1999/12/02 17:37:38 peter
  74. * moved *.pp into subdirs
  75. * fpcmaked
  76. Revision 1.5 1999/11/28 12:17:14 jonas
  77. * changed the requested graphdriver from $FF to VESA (= 10), so the
  78. test program works again with the new graph unit
  79. * undefined has_colors_equal for go32v2, because it is not anymore
  80. in the new graph unit
  81. }