# $XConsortium: polyline4.pi,v 5.2 91/11/26 14:49:53 hersh Exp $
## polyline4- test ppolyline with all combinations of widths and
## line types - based on polyline2, but ordering differently to
## work around bug.

tbegintest("polyline4", "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_DASH;  "dash";
			     PLINE_DOT;   "dot";
			     PLINE_DASH_DOT; "dotdash";
			     PLINE_SOLID; "solid";)

	pset_linetype(@linetype);

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

		# 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, "pln4");
	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();



