1 ------------------------------------------------------------------------------
3 -- GNAT ncurses Binding Samples --
9 ------------------------------------------------------------------------------
10 -- Copyright 2020 Thomas E. Dickey --
11 -- Copyright 2000,2006 Free Software Foundation, Inc. --
13 -- Permission is hereby granted, free of charge, to any person obtaining a --
14 -- copy of this software and associated documentation files (the --
15 -- "Software"), to deal in the Software without restriction, including --
16 -- without limitation the rights to use, copy, modify, merge, publish, --
17 -- distribute, distribute with modifications, sublicense, and/or sell --
18 -- copies of the Software, and to permit persons to whom the Software is --
19 -- furnished to do so, subject to the following conditions: --
21 -- The above copyright notice and this permission notice shall be included --
22 -- in all copies or substantial portions of the Software. --
24 -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
25 -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
26 -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
27 -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
28 -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
29 -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
30 -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
32 -- Except as contained in this notice, the name(s) of the above copyright --
33 -- holders shall not be used in advertising or otherwise to promote the --
34 -- sale, use or other dealings in this Software without prior written --
36 ------------------------------------------------------------------------------
37 -- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000
40 -- $Date: 2020/02/02 23:34:34 $
41 -- Binding Version 01.00
42 ------------------------------------------------------------------------------
43 with Terminal_Interface.Curses; use Terminal_Interface.Curses;
44 with ncurses2.util; use ncurses2.util;
46 -- Graphic-rendition test (adapted from vttest)
48 procedure ncurses2.test_sgr_attributes is
50 procedure xAdd (l : Line_Position; c : Column_Position; s : String);
52 procedure xAdd (l : Line_Position; c : Column_Position; s : String) is
54 Add (Line => l, Column => c, Str => s);
57 normal, current : Attributed_Character;
59 for pass in reverse Boolean loop
61 normal := (Ch => ' ', Attr => Normal_Video, Color => 0);
63 normal := (Ch => ' ', Attr =>
64 (Reverse_Video => True, others => False), Color => 0);
67 -- Use non-default colors if possible to exercise bce a little
69 Init_Pair (1, White, Blue);
72 Set_Background (Ch => normal);
74 xAdd (1, 20, "Graphic rendition test pattern:");
76 xAdd (4, 1, "vanilla");
79 current.Attr.Bold_Character := not current.Attr.Bold_Character;
80 Set_Background (Ch => current);
84 current.Attr.Under_Line := not current.Attr.Under_Line;
85 Set_Background (Ch => current);
86 xAdd (6, 6, "underline");
89 current.Attr.Bold_Character := not current.Attr.Bold_Character;
90 current.Attr.Under_Line := not current.Attr.Under_Line;
91 Set_Background (Ch => current);
92 xAdd (6, 45, "bold underline");
95 current.Attr.Blink := not current.Attr.Blink;
96 Set_Background (Ch => current);
100 current.Attr.Blink := not current.Attr.Blink;
101 current.Attr.Bold_Character := not current.Attr.Bold_Character;
102 Set_Background (Ch => current);
103 xAdd (8, 40, "bold blink");
106 current.Attr.Under_Line := not current.Attr.Under_Line;
107 current.Attr.Blink := not current.Attr.Blink;
108 Set_Background (Ch => current);
109 xAdd (10, 6, "underline blink");
112 current.Attr.Bold_Character := not current.Attr.Bold_Character;
113 current.Attr.Under_Line := not current.Attr.Under_Line;
114 current.Attr.Blink := not current.Attr.Blink;
115 Set_Background (Ch => current);
116 xAdd (10, 45, "bold underline blink");
119 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
120 Set_Background (Ch => current);
121 xAdd (12, 1, "negative");
124 current.Attr.Bold_Character := not current.Attr.Bold_Character;
125 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
126 Set_Background (Ch => current);
127 xAdd (12, 40, "bold negative");
130 current.Attr.Under_Line := not current.Attr.Under_Line;
131 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
132 Set_Background (Ch => current);
133 xAdd (14, 6, "underline negative");
136 current.Attr.Bold_Character := not current.Attr.Bold_Character;
137 current.Attr.Under_Line := not current.Attr.Under_Line;
138 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
139 Set_Background (Ch => current);
140 xAdd (14, 45, "bold underline negative");
143 current.Attr.Blink := not current.Attr.Blink;
144 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
145 Set_Background (Ch => current);
146 xAdd (16, 1, "blink negative");
149 current.Attr.Bold_Character := not current.Attr.Bold_Character;
150 current.Attr.Blink := not current.Attr.Blink;
151 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
152 Set_Background (Ch => current);
153 xAdd (16, 40, "bold blink negative");
156 current.Attr.Under_Line := not current.Attr.Under_Line;
157 current.Attr.Blink := not current.Attr.Blink;
158 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
159 Set_Background (Ch => current);
160 xAdd (18, 6, "underline blink negative");
163 current.Attr.Bold_Character := not current.Attr.Bold_Character;
164 current.Attr.Under_Line := not current.Attr.Under_Line;
165 current.Attr.Blink := not current.Attr.Blink;
166 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
167 Set_Background (Ch => current);
168 xAdd (18, 45, "bold underline blink negative");
170 Set_Background (Ch => normal);
171 Move_Cursor (Line => Lines - 2, Column => 1);
175 Add (Str => "Light");
177 Add (Str => " background. ");
178 Clear_To_End_Of_Line;
182 Set_Background (Ch => Blank2);
186 end ncurses2.test_sgr_attributes;