/* $XConsortium: iss1.pi,v 5.2 94/04/17 20:47:16 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. ******************************************************************/ ## iss1.pi - ## Test requirements: ## Test that incremental spatial search operation works with various starting ## paths. Test the incremental properties, that is, to use a starting path ## which resulted path from a previous search operation. source macro.pi source shmacro.pi tbegintest("iss1","incremental spatial search - incremental properties"); # INITIALIZE: data for a polyline, found and paths expected paths, normal and # inverted filters, reference point pts = IA_Ppoint(2, 0.3,0.5, 0.7,0.5); pl = I_Ppoint_list(2,pts); refpt = I_Ppoint(0.5,0.5); buf = malloc(128); er00 = I_Pelem_ref(0,0); startexecref = IA_Pelem_ref(1, er00); startpath = I_Pelem_ref_list(1,startexecref); foundpath = I_Pelem_ref_list(0,buf); er01 = I_Pelem_ref(0,1); er02 = I_Pelem_ref(0,2); er03 = I_Pelem_ref(0,3); er11 = I_Pelem_ref(1,1); er12 = I_Pelem_ref(1,2); er13 = I_Pelem_ref(1,3); er14 = I_Pelem_ref(1,4); er21 = I_Pelem_ref(2,1); er31 = I_Pelem_ref(3,1); expexecref1 = IA_Pelem_ref(1, er01); exppath1 = I_Pelem_ref_list(1, expexecref1); expexecref2 = IA_Pelem_ref(3, er02, er11, er31); exppath2 = I_Pelem_ref_list(3, expexecref2); expexecref3 = IA_Pelem_ref(2, er02, er12); exppath3 = I_Pelem_ref_list(2, expexecref3); expexecref4 = IA_Pelem_ref(3, er02, er13, er21); exppath4 = I_Pelem_ref_list(3, expexecref4); expexecref5 = IA_Pelem_ref(2, er02, er14); exppath5 = I_Pelem_ref_list(2, expexecref5); expexecref6 = IA_Pelem_ref(2, er03, er21); exppath6 = I_Pelem_ref_list(2, expexecref6); normfilter = I_Pfilter_list(0,NULL); invfilter = I_Pfilter_list(0,NULL); # SETUP: open phigs, create a structure network of the following form: # 0 # | \ # | 1 # | / \ # 2 3 i_open_phigs(NULL,0); # set up structure 0 popen_struct(0); ppolyline(&pl); pexec_struct(1); pexec_struct(2); pclose_struct(); # set up structure 1 popen_struct(1); pexec_struct(3); ppolyline(&pl); pexec_struct(2); ppolyline(&pl); pclose_struct(); # set up structure 2 popen_struct(2); ppolyline(&pl); pclose_struct(); # set up structure 3 popen_struct(3); ppolyline(&pl); pclose_struct(); #OPERATIONS and VERIFICATIONS # perform iss: # . with a reference point and distance such that the primitive always lies # withing the search space # . without a ceiling (ceiling = 1) # . with empty filters such that the filter requirements is always satisfied # start path = (0,0), expected found path = (0,1) err = i_bogus_error(); pincr_spa_search(&refpt,0.0,&startpath,PIND_NO_CLIP,1,&normfilter,&invfilter, 128,0,&err,&foundpath,&total_len); im_ifneq(err,0,"ERROR: %d in pincr_spa_search\n",err); im_confirm_isspath(foundpath,exppath1, "failed: found path != expected for start path = (0,0)\n"); # start path = (0,1), expected found path = (0,2)(1,1)(3,1) pincr_spa_search(&refpt,0.0,&exppath1,PIND_NO_CLIP,1,&normfilter,&invfilter, 128,0,&err,&foundpath,&total_len); im_ifneq(err,0,"ERROR: %d in pincr_spa_search\n",err); im_confirm_isspath(foundpath,exppath2, "failed: found path != expected for start path = (0,1)\n"); # start path = (0,2)(1,1)(3,1), expected found path = (0,2)(1,2) pincr_spa_search(&refpt,0.0,&exppath2,PIND_NO_CLIP,1,&normfilter,&invfilter, 128,0,&err,&foundpath,&total_len); im_ifneq(err,0,"ERROR: %d in pincr_spa_search\n",err); im_confirm_isspath(foundpath,exppath3, "failed: found path != expected for start path = (0,2)(1,1)(3,1)\n"); # start path = (0,2)(1,2), expected found path = (0,2)(1,3)(2,1) pincr_spa_search(&refpt,0.0,&exppath3,PIND_NO_CLIP,1,&normfilter,&invfilter, 128,0,&err,&foundpath,&total_len); im_ifneq(err,0,"ERROR: %d in pincr_spa_search\n",err); im_confirm_isspath(foundpath,exppath4, "failed: found path != expected for start path = (0,2)(1,2)\n"); # start path = (0,2)(1,3)(2,1), expected found path = (0,2)(1,4) pincr_spa_search(&refpt,0.0,&exppath4,PIND_NO_CLIP,1,&normfilter,&invfilter, 128,0,&err,&foundpath,&total_len); im_ifneq(err,0,"ERROR: %d in pincr_spa_search\n",err); im_confirm_isspath(foundpath,exppath5, "failed: found path != expected for start path = (0,2)(1,3)(2,1)\n"); # start path = (0,2)(1,4), expected found path = (0,3)(2,1) pincr_spa_search(&refpt,0.0,&exppath5,PIND_NO_CLIP,1,&normfilter,&invfilter, 128,0,&err,&foundpath,&total_len); im_ifneq(err,0,"ERROR: %d in pincr_spa_search\n",err); im_confirm_isspath(foundpath,exppath6, "failed: found path != expected for start path = (0,2)(1,4)\n"); tendtest();