# $XConsortium: polyline2.pi,v 5.2 91/11/26 14:49:41 hersh Exp $
## polyline2 - test /*WARNING: parameters changed */ ppolyline with all various combinations of widths and
## line types.

tbegintest("polyline2", "POLYLINE with combinations of width & line type");

source macro.pi		

imagename = malloc(16);
imagetext = malloc(100);

# Set up phigs, workstation, and structure
i_open_phigs(NULL,PDEF_MEM_SIZE);
i_open_x_ws(1, &display, &window, 100, 300, 200, 200);
popen_struct(1);
ppost_struct(1,1,1.0);

foreach @linetype @typename (PLINE_SOLID; "solid";
			     PLINE_DASH;  "dash";
			     PLINE_DOT;   "dot";
			     PLINE_DASH_DOT; "dotdash")

	pset_linetype(@linetype);

	foreach @size @y1 @y2 ( 0.0;  0.9;  0.8;
				0.2;  0.7;  0.6;
				1.0;  0.5;  0.4;
				2.5;  0.3;  0.2;
				10.2; 0.1;  0.05;)

		# draw a crooked line with given type and size
		pset_linewidth(@size);
		points4 = IA_Ppoint(4, 0.1,@y1,  0.5,@y1, 
				       0.3,@y2,  0.8,@y1);
		line4 = I_Ppoint_list(4, points4);
		ppolyline(&line4);
	end;

	# compose the image name and description, compare images
	strcpy(imagename, "pln2");
	strcat(imagename, @typename);
	strcpy(imagetext, "polylines of different widths, type ");
	strcat(imagetext, @typename);
	i_check_image(imagename,display,window,0,0,200,200,imagetext);
	i_pause();

	# empty the structure
	pempty_struct(1);
end;

tendtest();



