Skip to content

Commit

Permalink
clean tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonMiraj committed Aug 18, 2024
1 parent 6ff8b7d commit 083708b
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 176 deletions.
22 changes: 8 additions & 14 deletions test/chess.f90
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
program chess_checker
use fig_canvas
use fig_drawing
use fig_rgb
use fig_shapes
use fig_rgb_color_constants
use fig_svg
use fig_bitmap
use fig
use fig_test
implicit none
integer, parameter :: WIDTH = 800
Expand All @@ -21,7 +15,7 @@ program chess_checker
type(svg_canvas) :: svg_canva
type(bitmap_canvas) :: bitmap_canva
type(rectangle) :: rect
type(RGB) :: ALTERNATE_COLOR, BACKGROUND_COLOR, color
type(RGB) :: ALTERNATE_COLOR, BACKGROUND_COLOR
file_name = "checker"
call checker%init()

Expand All @@ -31,17 +25,17 @@ program chess_checker

do y = 0, rows - 1
do x = 0, cols - 1
if (mod(x + y, 2) == 0) then
color = ALTERNATE_COLOR
else
color = BACKGROUND_COLOR
endif

rect%upper_left%x = (x * 1.0 / cols)
rect%upper_left%y = (y * 1.0 / rows)
rect%width = CELL_WIDTH
rect%height = CELL_HEIGHT
rect%fill_color = color

if (mod(x + y, 2) == 0) then
rect%fill_color = ALTERNATE_COLOR
else
rect%fill_color = BACKGROUND_COLOR
endif

call checker%add_shape(rect)
end do
Expand Down
5 changes: 2 additions & 3 deletions test/circ.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ program circles_pattern
integer, parameter :: CELL_WIDTH = (WIDTH/cols)
integer, parameter :: CELL_HEIGHT =(HEIGHT/rows)
character(len=:), allocatable :: file_name
integer :: result,x,y
integer :: x,y
real :: center_x, center_y
real :: u, v, t,shade
real :: t
real :: radius
type(drawing) :: canva
type(RGB) :: color
type(RGB), dimension(8) :: color_palette
type(circle) :: circ

Expand Down
72 changes: 0 additions & 72 deletions test/circle.f90

This file was deleted.

32 changes: 29 additions & 3 deletions test/drawing_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ program drawing_test_all
type(drawing) :: canva
type(circle) :: c
type(rectangle) :: r
type(triangle) :: tri
type(line) :: l
type(ellipse) :: elp
type(arc) :: ar
type(text) :: te
type(RGB) :: bg, color
type(svg_canvas) :: svg_canva
type(bitmap_canvas) :: bitmap_canva
Expand Down Expand Up @@ -76,7 +76,7 @@ program drawing_test_all
r%stroke_color%a=.5
call canva%add_shape(r)

! Line
! Line 1
l%p1%x = 400.0 / CANVAS_WIDTH
l%p1%y = 200.0 / CANVAS_HEIGHT
l%p2%x = 550.0 / CANVAS_WIDTH
Expand Down Expand Up @@ -106,7 +106,7 @@ program drawing_test_all
call canva%add_shape(l)


! arc
! Arc
ar%center%x = 300.0 / CANVAS_WIDTH
ar%center%y = 400.0 / CANVAS_HEIGHT
ar%r = 50.0
Expand All @@ -117,6 +117,32 @@ program drawing_test_all
ar%stroke_color = FIG_COLOR_BROWN
call canva%add_shape(ar)


! Text
te%p%x=.0
te%p%y=.5
te%slant=FIG_FONT_SLANT_ITALIC
te%weight=FIG_FONT_WEIGHT_BOLD
te%size = 20
te%content="Hello, Fortran"
te%font_family="sans"
te%fill_color=FIG_COLOR_RED
te%stroke_color=FIG_COLOR_BLACK
call canva%add_shape(te)

! Text
te%p%x=.0
te%p%y=.7
te%slant=FIG_FONT_SLANT_OBLIQUE
te%weight=FIG_FONT_WEIGHT_NORMAL
te%size = 20
te%content="Hello, Fortarn"
te%font_family="sans"
te%fill_color=FIG_COLOR_RED
te%stroke_color=FIG_COLOR_BLACK
call canva%add_shape(te)


call svg_canva%init(CANVAS_WIDTH,CANVAS_HEIGHT,file_name)
call svg_canva%apply_shapes(canva)
call svg_canva%save_to_svg()
Expand Down
Binary file removed test/expected/green_blob.ppm
Binary file not shown.
9 changes: 0 additions & 9 deletions test/expected/green_blob.svg

This file was deleted.

3 changes: 2 additions & 1 deletion test/fortran_logo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ program logo_path_test
v 3.24734 &
H 81.684896 &
H 66.01647 &
Z"
&Z"
my_path%fill_color = FIG_COLOR_WHITE
my_path%stroke_color = FIG_COLOR_PURPLE
call canva%add_shape(my_path)

! Save to bitmap and SVG
Expand Down
2 changes: 0 additions & 2 deletions test/line.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ program radial_lines

type(drawing) :: radial_canvas
type(line) :: sh
type(RGB) :: color
type(svg_canvas) :: svg_canva
type(bitmap_canvas) :: bitmap_canva
type(RGB), dimension(8) :: color_palette
Expand Down Expand Up @@ -63,7 +62,6 @@ subroutine draw_radial_line(canva, cx, cy, radius, angle)
type(drawing), intent(inout) :: canva
real, intent(in) :: cx, cy, radius
real, intent(in) :: angle
integer :: x1, y1, x2, y2
real :: cos_angle, sin_angle

cos_angle = cos(angle)
Expand Down
4 changes: 1 addition & 3 deletions test/poly_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ program path_test

real :: polygon_x_points(5) = [200.0, 140.0, 290.0, 110.0, 260.0]
real :: polygon_y_points(5) = [10.0, 198.0, 78.0, 78.0, 198.0]
integer :: n=7,n2=5,i
type(point), allocatable:: points(:)
integer :: p_count, real_ind
integer :: n=7,n2=5

x_points=x_points/CANVAS_WIDTH
y_points=y_points/CANVAS_HEIGHT
Expand Down
69 changes: 0 additions & 69 deletions test/text.f90

This file was deleted.

0 comments on commit 083708b

Please sign in to comment.