File: testsuite_graphics_include.kbs

package info (click to toggle)
basic256 2.0.99.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,888 kB
  • sloc: cpp: 17,185; yacc: 4,025; lex: 1,466; java: 1,091; sh: 39; xml: 33; makefile: 20
file content (150 lines) | stat: -rw-r--r-- 3,425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# testsuite_graphics_include for BASIC256

# Modification History
# date		programmer	description
# 2012????	j.m.reneau	original coding
# 20140529	j.m.reneau	split to own include
# 20160805	j.m.reneau	added tests to make more complete
# 20161101  j.m.reneau  added [] to all array passing to functions
# 20170514 j.m.reneau   removed penwidth 0 before text output
# 20201122 j.m.reneau   added named colors

currentsuite = "graphics"

# test the basic graphics statements

clg
color blue
rect 10,10,20,20
call q("Blue rectangle")
call n("is 20,20 blue",pixel(20,20), blue)
call n("pen and brush blue",getcolor(), getbrushcolor())

#
clg
color "red"
call n("is current color red",getcolor, red)
circle 30,30,10
call q("red circle")
#
clg
for t = 1 to 10
   color rgb(rand*256,rand*256,rand*256), rgb(rand*256,rand*256,rand*256)
   circle rand*300,rand*300,rand*10+10
next t
call q("10 random circles")
#
clg
color black
for t = 0 to 300 step 3
   line 0,0,t,300
   line 0,0,300,t
next t
call q("morie pattern std size")
#
graphsize 200,150
clg
color black
for t = 0 to 1 step .01
   line 0,0,t*graphwidth,graphheight
   line 0,0,graphwidth,t*graphheight
next t
call q("morie pattern odd size")
graphsize 300,300
#
clg
color "black"
call n("is current color black",getcolor, black)
for x = 0 to 10 step .1
   y = (100- x^2)^.5
   plot 150-x, 150-y
   plot 150-x, 150+y
   plot 150+x, 150-y
   plot 150+x, 150+y
next x
call q("circle using x^2+y^2=r^2")
#
clg
penwidth 10
color green, blue
redim c(1)
c = {100, 100, 200, 200, 100, 200}
poly c[]
penwidth 5
color orange, black
poly {{100, 100}, {200, 200}, {200, 100}}
call q("poly - orange/black and green/blue triangles with different fill and pen")
#
clg
penwidth 1
color red
font "Times New Roman",18,50
text 10,100,"This is Times New Roman"
color darkgreen
font "Tahoma",10,100
text 10,200,"This is Tahoma!"
call q("Font - Times and Tahoma")
#
clg
dim c(6)
c[0] = 0
c[1] = 0
c[2] = 20
c[3] = 20
c[4] = 15
c[5] = 10
color yellow
for r = 0 to (2 * pi) step (pi/8)
        stamp graphwidth/2, graphheight/2, 6, r, c[]
next r
c = {{0,0}, {20,20}, {15,10}}
color darkorange
for r = 0 to (2 * pi) step (pi/8)
        stamp graphwidth/2, graphheight/2, 4, r, c[]
next r
color red
for r = 0 to (2 * pi) step (pi/8)
        stamp graphwidth/2, graphheight/2, 2, r, {0,0,20,20,15,10}
next r
color black
for r = 0 to (2 * pi) step (pi/8)
        stamp graphwidth/2, graphheight/2, 1, r, {{0,0}, {20,20}, {15,10}}
next r
call q("stamp - 16 pointed yellow to black wheel")

clg
color orange
circle 150,150,150
color black
chord 70,100,60,90,1.5*PI, PI
chord 170,100,60,90,1.5*PI, PI
color yellow
circle 110,140,20
circle 210,140,20
color black, clear
call n("pen and brush different",getcolor() = getbrushcolor(),0)
penwidth 10
pie 90,120,120,120,.75*pi,.5*pi
call n("getpenwidth - did it set to 10", getpenwidth(), 10)
penwidth 1
call q("chord,pie - yellow eyed monster with chevron for mouth")
call n("getpenwidth - did it set BACK to 1", getpenwidth(), 1)

clg
color "deeppink"
rect 50,50,100,100
color "darkslateblue","clear"
penwidth 10
rect 100,100,100,100
color "#a0ffffff"
rect 150,150,100,100
call q("deep pink filled with slate blue unfilled with translucent white rectangle over top?")
penwidth 1

color "clear"
call n("getcolor - string clear same as clear constant", getcolor(), clear)
color "blue"
call n("getcolor - string blue same as blue constant", getcolor(), blue)