tcrt.pp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. { %INTERACTIVE }
  2. {
  3. $Id$
  4. Program to test CRT unit by Mark May.
  5. Only standard TP functions are tested (except WhereX, WhereY).
  6. }
  7. program tesicrt;
  8. uses crt;
  9. var
  10. i,j : longint;
  11. fil : text;
  12. c : char;
  13. begin
  14. {Window/AssignCrt/GotoXY}
  15. clrscr;
  16. writeln ('This should be on a clear screen...');
  17. gotoxy (10,10);
  18. writeln ('(10,10) is the coordinate of this sentence');
  19. window (10,11,70,22);
  20. writeln ('Window (10,11,70,22) executed.');
  21. writeln ('Sending some output to a file, assigned to crt.');
  22. assigncrt ( fil);
  23. rewrite (fil);
  24. writeln (fil,'This was written to the file, assigned to the crt.');
  25. writeln (fil,'01234567890123456789012345678901234567890123456789012345678901234567890');
  26. close (fil);
  27. writeln ('The above too, but this not any more');
  28. write ('Press any key to continue');
  29. c:=readkey;
  30. clrscr;
  31. writeln ('the small window should have been cleared.');
  32. write ('Press any key to continue');
  33. c:=readkey;
  34. {Colors/KeyPressed}
  35. window (1,1,80,25);
  36. clrscr;
  37. writeln ('Color testing :');
  38. writeln;
  39. highvideo;
  40. write ('highlighted text');
  41. normvideo;
  42. write (' normal text ');
  43. lowvideo;
  44. writeln ('And low text.');
  45. writeln;
  46. writeln ('Color chart :');
  47. for i:=black to lightgray do
  48. begin
  49. textbackground (i);
  50. textcolor (0);
  51. write ('backgr. : ',i:2,' ');
  52. for j:= black to white do
  53. begin
  54. textcolor (j);
  55. write (' ',j:2,' ');
  56. end;
  57. writeln;
  58. end;
  59. normvideo;
  60. writeln ('The same, with blinking foreground.');
  61. for i:=black to lightgray do
  62. begin
  63. textbackground (i);
  64. textcolor (0);
  65. write ('backgr. : ',i:2,' ');
  66. for j:= black to white do
  67. begin
  68. textcolor (j+128);
  69. write (' ',j:2,' ');
  70. end;
  71. writeln;
  72. end;
  73. textcolor (white);
  74. textbackground (black);
  75. writeln;
  76. writeln ('press any key to continue');
  77. repeat until keypressed;
  78. c:=readkey;
  79. {ClrEol/DelLine/InsLine}
  80. clrscr;
  81. writeln ('Testing some line functions :');
  82. writeln ;
  83. writeln ('This line should become blank after you press enter');
  84. writeln;
  85. writeln ('The following line should then become blank from column 10');
  86. writeln ('12345678901234567890');
  87. writeln;
  88. writeln ('This line should dissapear.');
  89. writeln;
  90. writeln ('Between this line and the next, an empty line should appear.');
  91. writeln ('This is the next line, above which the empty one should appear');
  92. writeln;
  93. write ('Press any key to observe the predicted effects.');
  94. readkey;
  95. gotoxy(1,3);clreol;
  96. gotoxy (10,6);clreol;
  97. gotoxy (1,8);delline;
  98. gotoxy (1,10); insline;
  99. gotoxy (17,13); clreol;
  100. writeln ('end.');
  101. readkey;
  102. end.