Changeset 981 for trunk/psLib/test/image/tst_psImage.c
- Timestamp:
- Jun 10, 2004, 8:48:35 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImage.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImage.c
r980 r981 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06-10 03:16:13$8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-10 18:48:35 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 804 804 specified operation. Valid operations include =, +, -, *, /. 805 805 806 Verify the returned integer is equal to the number of pixels modified806 Verify the returned integer is zero 807 807 and the input parameter psImage structure is modified at the specified 808 808 location and range with the given overlay image and the specified … … 811 811 different platforms. 812 812 813 Verify the returned integer is equal to zero and the input psImage structure814 is unmodified, if the overlay specified is not within the data range of the815 input psImage structure.816 817 Verify the returned integer is equal to zero, the input psImage818 structure is unmodified and program execution doesn't stop, if the819 overlay specified is null.820 821 Verify the returned integer is equal to zero and program execution822 doesn't stop, if the input parameter image is null.823 824 Verify program execution doen't stop, if the overly image contains825 zero values with division operation is specified.826 813 */ 827 814 … … 850 837 for (unsigned row=0;row<r;row++) { \ 851 838 ps##DATATYPE* imgRow = img->data.DATATYPE[row]; \ 839 ps##DATATYPE* img2Row = img2->data.DATATYPE[row]; \ 852 840 for (unsigned col=0;col<c;col++) { \ 853 841 ps##DATATYPE val = 6.0; \ … … 860 848 return 2; \ 861 849 } \ 850 if (row < r/2 && col < c/2 && fabsf(img2Row[col] - 2.0) > FLT_EPSILON) { \ 851 psError(__func__,"Overlay modified at %d,%d (%.2f for %s)", \ 852 col,row,img2Row[col],OPSTRING); \ 853 return 2; \ 854 } \ 862 855 } \ 863 856 } \ … … 881 874 testOverlayType(U8); 882 875 876 /* 877 Verify the returned integer is equal to non-zero and the input psImage structure 878 is unmodified, if the overlay specified is not within the data range of the 879 input psImage structure. 880 */ 881 882 img = psImageAlloc(c,r,PS_TYPE_F32); 883 for (unsigned row=0;row<r;row++) { 884 psF32* imgRow = img->data.F32[row]; 885 for (unsigned col=0;col<c;col++) { 886 imgRow[col] = 6.0f; 887 } 888 } 889 img2 = psImageAlloc(c,r,PS_TYPE_F32); 890 for (unsigned row=0;row<r;row++) { 891 psF32* img2Row = img2->data.F32[row]; 892 for (unsigned col=0;col<c;col++) { 893 img2Row[col] = 2.0f; 894 } 895 } 896 897 psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay isn't within image boundaries"); 898 retVal = psImageOverlaySection(img,img2,c/4,r/4,"+"); 899 if (retVal == 0) { 900 psError(__func__,"psImageOverlaySection returned zero even though " 901 "overlay too big"); 902 return 3; 903 } 904 for (unsigned row=0;row<r;row++) { 905 psF32* imgRow = img->data.F32[row]; 906 for (unsigned col=0;col<c;col++) { 907 if (imgRow[col] != 6.0f) { 908 psError(__func__,"Input image modified when overlay size too big"); 909 return 4; 910 } 911 } 912 } 913 914 /* 915 Verify the returned integer is equal to non-zero, the input psImage 916 structure is unmodified and program execution doesn't stop, if the 917 overlay specified is null. 918 */ 919 920 psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay is NULL"); 921 retVal = psImageOverlaySection(img,NULL,c/4,r/4,"+"); 922 if (retVal == 0) { 923 psError(__func__,"psImageOverlaySection returned zero even though " 924 "overlay too big"); 925 return 5; 926 } 927 for (unsigned row=0;row<r;row++) { 928 psF32* imgRow = img->data.F32[row]; 929 for (unsigned col=0;col<c;col++) { 930 if (imgRow[col] != 6.0f) { 931 psError(__func__,"Input image modified when overlay NULL"); 932 return 6; 933 } 934 } 935 } 936 937 /* 938 Verify the returned integer is equal to non-zero and program execution 939 doesn't stop, if the input parameter image is null. 940 */ 941 942 psLogMsg(__func__,PS_LOG_INFO,"Following should error as image input is NULL"); 943 retVal = psImageOverlaySection(NULL,img2,c/4,r/4,"+"); 944 if (retVal == 0) { 945 psError(__func__,"psImageOverlaySection returned zero even though " 946 "overlay too big"); 947 return 7; 948 } 949 950 /* 951 Verify program execution doen't stop, if the overly image contains 952 zero values with division operation is specified. 953 */ 954 for (unsigned row=0;row<r;row++) { 955 psF32* img2Row = img2->data.F32[row]; 956 for (unsigned col=0;col<c;col++) { 957 img2Row[col] = 0.0f; 958 } 959 } 960 retVal = psImageOverlaySection(img,img2,0,0,"/"); 961 if (retVal != 0) { 962 psError(__func__,"psImageOverlaySection returned non-zero when " 963 "checking divide-by-zero."); 964 return 8; 965 } 966 967 psImageFree(img); 968 psImageFree(img2); 969 883 970 return 0; 884 971 }
Note:
See TracChangeset
for help on using the changeset viewer.
