/* $XConsortium: viewxf4.pi,v 5.2 94/04/17 20:47:29 rws Exp $ */ /***************************************************************** Copyright (c) 1989, 1990, 1991,1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 1989, 1990, 1991,1990 by Sun Microsystems, Inc. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Sun Microsystems, and the X Consortium, not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ ## viewxf4.pi - ## Test view index attribute inheritance ## Test that view index attribute, which is set in a parent structure, ## is inherited by a child structure. ## Test that view index attribute, which is set in a child structure, ## affects the child structure, but not the parent. ## Draw polylines and verify the presence of pixels in the expected locations source macro.pi source xpmacro.pi tbegintest("viewxf4","view index attribute inheritance"); # SETUP: open phigs and a workstation, open and post a structure i_open_phigs(NULL,PDEF_MEM_SIZE); i_open_x_ws(1,&xdisplay,&xwindow,0,0,200,200); # INITIALIZE: view representation 1&2 i_identity(mapmtx); cliplimit = I_Plimit(0.0,1.0, 0.0,1.0); vrp1 = I_Ppoint(0.0,0.0); vup1 = I_Ppoint(0.0,1.0); err = i_bogus_error(); peval_view_ori_matrix(&vrp1,&vup1,&e,orientmtx); im_ifneq(e,0,"ERROR: %d in peval_view_ori_matrix\n",err); viewrep1 = I_Pview_rep(orientmtx,mapmtx,cliplimit,PIND_CLIP); vrp2 = I_Ppoint(0.25,0.25); vup2 = I_Ppoint(0.0,1.0); peval_view_ori_matrix(&vrp2,&vup2,&e,orientmtx); im_ifneq(e,0,"ERROR: %d in peval_view_ori_matrix\n",err); viewrep2 = I_Pview_rep(orientmtx,mapmtx,cliplimit,PIND_CLIP); pset_view_rep(1,1,&viewrep1); pset_view_rep(1,2,&viewrep2); # initialize data points for the lines to be drawn parentline1 = IA_Ppoint(2, 0.25,0.25, 0.35,0.25); parentline2 = IA_Ppoint(2, 0.75,0.25, 0.85,0.25); childline1 = IA_Ppoint(2, 0.25,0.75, 0.35,0.75); childline2 = IA_Ppoint(2, 0.75,0.75, 0.85,0.75); pl1 = I_Ppoint_list(2,parentline1); pl2 = I_Ppoint_list(2,parentline2); cl1 = I_Ppoint_list(2,childline1); cl2 = I_Ppoint_list(2,childline2); p1 = IA_Ppoint3(2, 0.25,0.25,0.0, 0.35,0.25,0.0,); p2 = IA_Ppoint3(2, 0.75,0.25,0.0, 0.85,0.25,0.0,); c1 = IA_Ppoint3(2, 0.25,0.75,0.0, 0.35,0.75,0.0,); c2 = IA_Ppoint3(2, 0.75,0.75,0.0, 0.85,0.75,0.0,); # OPERATION: create parent and child structures and perform hierachical viewing popen_struct(1); pset_view_ind(1); ppolyline(&pl1); pexec_struct(2); ppolyline(&pl2); pclose_struct(); popen_struct(2); ppolyline(&cl1); pset_view_ind(2); ppolyline(&cl2); pclose_struct(); ppost_struct(1,1,1.0); # VERIFICATION: parentline 1&2 should be rendered using view 1 # childline 1 should be rendered using view 1 # childline 2 should be rendered using view 2 im_confirm_line3(xdisplay,xwindow,1,1,p1,5,1, "failed: (parent) line at ll corner is not rendered correctly with view1\n",NULL); im_confirm_line3(xdisplay,xwindow,1,1,p2,5,1, "failed: (parent) line at lr corner is not rendered correctly with view1\n",NULL); im_confirm_line3(xdisplay,xwindow,1,1,c1,5,1, "failed: (child) line at ul corner is not rendered correctly with view1\n",NULL); im_confirm_line3(xdisplay,xwindow,1,2,c2,5,1, "failed: (child) line at ur corner is not rendered correctly with view2\n",NULL); i_pause(); tendtest();