/* $XConsortium: poststr1.pi,v 5.2 94/04/17 20:48:08 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. ******************************************************************/ ## poststr1.pi - post non-existent, open, and closed structures, test ## with pinq_posted_structs() pinq_struct_status(), plus pixel retrieval ## (reading back polymarkers). Non-existent structure should be ## created, open and closed structs should be successfully posted. tbegintest("poststr1","post non-existent, open, and closed structures."); source macro.pi /* general testing utility macros */ source strmacro.pi /* macros for structure testing */ source apimacro.pi /* macros for api-specific functions */ # initialize phigs i_open_phigs(NULL, PDEF_MEM_SIZE); i_open_x_ws(1, &display, &window, 100, 200, 200, 200); # post a non-existent structure - should be created as an empty # structure, and posted. ppost_struct(1, 1, 0.5); im_confirm_struct_status(1, PSTRUCT_STATUS_EMPTY, "failed: posted non-existent structure should have status EMPTY, has %d\n"); poststat = i_is_posted_struct(1, 1, &priority); im_ifneq(poststat, 1, "failed: posted non-existent structure not posted\n", NULL); # open structure case: # open a structure, set polymarker color and draw polymarker, # post structure, pause to allow update - confirm posted # status, and confirm polymarker pixels with pixel readback. pt = I_Ppoint3(0.2, 0.2, 0.0); ptlst = I_Ppoint_list3(1, &pt); popen_struct(2); pset_marker_colr_ind(5); ppolymarker(&ptlst); ppost_struct(1, 2, 0.4); sleep(2); poststat = i_is_posted_struct(1, 2, &priority); im_ifneq(poststat, 1, "failed: posted open structure not posted\n", NULL); pixelstat = i_check_pixel3(display, window, 1, 0, pt, 7, 5); im_ifneq(pixelstat, 1, "failed: polymarker in open posted struct: pixels not found\n", NULL); pclose_struct(); # closed structure case: # open a structure, set polymarker color and draw polymarker, close and # post structure, pause to allow update - confirm posted # status, and confirm polymarker pixels with pixel readback. # Also, confirm that the open structure is still posted. pt2 = I_Ppoint3(0.2, 0.8, 0.0); ptlst2 = I_Ppoint_list3(1, &pt2); popen_struct(3); pset_marker_colr_ind(4); ppolymarker(&ptlst2); pclose_struct(); ppost_struct(1, 3, 0.9); sleep(2); poststat = i_is_posted_struct(1, 3, &priority); im_ifneq(poststat, 1, "failed: posted closed structure not posted\n", NULL); pixelstat = i_check_pixel3(display, window, 1, 0, pt2, 7, 4); im_ifneq(pixelstat, 1, "failed: polymarker in closed posted struct: pixels not found\n", NULL); # confirming other structure still there poststat = i_is_posted_struct(1, 2, &priority); im_ifneq(poststat, 1, "failed: posted open structure not posted after posting another\n", NULL); pixelstat = i_check_pixel3(display, window, 1, 0, pt, 7, 5); im_ifneq(pixelstat, 1, "failed: polymarker in open posted struct: pixels not found after posting another\n", NULL); tendtest();