Index: trunk/psLib/test/image/tst_psImageFFT.c
===================================================================
--- trunk/psLib/test/image/tst_psImageFFT.c	(revision 1979)
+++ trunk/psLib/test/image/tst_psImageFFT.c	(revision 1984)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-06 19:36:30 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:40:13 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -88,4 +88,9 @@
         return 1;
     }
+    if (img2->numCols != m || img2->numRows != n) {
+        psError(__func__,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",
+                img2->numCols,img2->numRows,m,n);
+        return 2;
+    }
 
     // 3. verify that the only significant component cooresponds to the freqency of the input in step 1.
@@ -99,4 +104,5 @@
                         && ! (row == 0 && (col==1 || col == n-1)) ) {
                     psError(__func__,"Result invalid at %d,%d (%.2f)",col,row,mag);
+                    return 3;
                 }
             } else
@@ -104,4 +110,5 @@
                         || (row == 0 && (col==1 || col == n-1)) ) {
                     psError(__func__,"Result invalid at %d,%d (%.2f)",col,row,mag);
+                    return 4;
                 }
         }
@@ -114,5 +121,11 @@
     if (img3->type.type != PS_TYPE_C32) {
         psError(__func__,"FFT didn't produce complex values?");
-        return 4;
+        return 5;
+    }
+
+    if (img3->numCols != m || img3->numRows != n) {
+        psError(__func__,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",
+                img3->numCols,img3->numRows,m,n);
+        return 6;
     }
 
@@ -125,7 +138,49 @@
                 psError(__func__,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",
                         col,row,pixel,imgRow[col]);
-                return 5;
-            }
-        }
+                return 7;
+            }
+        }
+    }
+
+    // 4. perform a reverse transform to real result
+    img3 = psImageFFT(img3,img2,PS_FFT_REVERSE|PS_FFT_REAL_RESULT);
+
+    if (img3->type.type != PS_TYPE_F32) {
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,img3->type.type)
+        psError(__func__,"FFT asked to make real result, but I got a %s type image?",typeStr);
+        return 8;
+    }
+
+    if (img3->numCols != m || img3->numRows != n) {
+        psError(__func__,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",
+                img3->numCols,img3->numRows,m,n);
+        return 9;
+    }
+
+    for (unsigned int row=0;row<n;row++) {
+        psF32* img3Row = img3->data.F32[row];
+        psF32* imgRow = img->data.F32[row];
+        for (unsigned int col=0;col<m;col++) {
+            psF32 pixel = img3Row[col]/m/n;
+            if (fabsf(pixel-imgRow[col]) > 0.1) {
+                psError(__func__,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",
+                        col,row,pixel,imgRow[col]);
+                return 10;
+            }
+        }
+    }
+
+    // check if error occurs if FORWARD and REVERSE are both given.
+    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error.");
+    if (psImageFFT(NULL,img2,PS_FFT_REVERSE|PS_FFT_FORWARD) != NULL) {
+        psError(__func__,"PS_FFT_REVERSE|PS_FFT_FORWARD option produced something?");
+        return 11;
+    }
+
+    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error.");
+    if (psImageFFT(NULL,img2,PS_FFT_FORWARD|PS_FFT_REAL_RESULT) != NULL) {
+        psError(__func__,"PS_FFT_FORWARD|PS_FFT_REAL_RESULT option produced something?");
+        return 12;
     }
 
