Index: trunk/psLib/test/image/tst_psImageExtraction.c
===================================================================
--- trunk/psLib/test/image/tst_psImageExtraction.c	(revision 1957)
+++ trunk/psLib/test/image/tst_psImageExtraction.c	(revision 1961)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-10-05 19:42:51 $
+*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-10-05 22:21:53 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -43,6 +43,9 @@
     psVector* out = NULL;
     psImage* image = psImageAlloc( c, r, PS_TYPE_F32 );
+    psImage* imgU8 = psImageAlloc( c, r, PS_TYPE_U8 );
     psVector* positions = psVectorAlloc( r, PS_TYPE_U32 );
     psImage* mask = psImageAlloc( c, r, PS_TYPE_MASK );
+    psImage* maskS8 = psImageAlloc( c, r, PS_TYPE_S8 );
+    psImage* maskSz = psImageAlloc( r, c, PS_TYPE_MASK );
     psStats* stat = psStatsAlloc( PS_STAT_SAMPLE_MEDIAN );
 
@@ -63,9 +66,15 @@
     for ( int row = 0;row < r;row++ ) {
         psF32* imageRow = image->data.F32[ row ];
-        psMaskType* maskRow = image->data.V[ row ];
+        psU8* imgU8Row = imgU8->data.U8[ row ];
+        psMaskType* maskRow = mask->data.V[ row ];
+        psMaskType* maskSzRow = maskSz->data.V[ row ];
+        psS8* maskS8Row = maskS8->data.V[ row ];
         psF32 rowOffset = ( psF32 ) row / ( psF32 ) r;
         for ( int col = 0;col < c;col++ ) {
             imageRow[ col ] = ( psF32 ) col + rowOffset;
+            imgU8Row[ col ] = (psU8) col;
             maskRow[ col ] = 0;
+            maskS8Row[ col ] = 0;
+            maskSzRow[ col ] = 0;
         }
     }
@@ -282,4 +291,50 @@
     }
 
+    /* Verify that a mask of different size than the input image returns null and program
+       execution doesn't stop.
+    */
+    psLogMsg( __func__, PS_LOG_INFO, "Following should be an error mask size != image size.");
+    stat->options = PS_STAT_SAMPLE_MEDIAN;
+    out = psImageSlice( out, NULL,
+                        image,
+                        maskSz, 1,
+                        c/10, r/10,
+                        c/10+1, r/10+1,
+                        PS_CUT_X_POS,
+                        stat);
+    if ( out != NULL ) {
+        psError( __func__, "Mask size different than image size didn't return NULL as expected" );
+        return 110;
+    }
+
+    /* Verify the a invalid type mask returns null and program execution doesn't stop.
+    */
+    psLogMsg( __func__, PS_LOG_INFO, "Following should be an error invalid mask type.");
+    out =  psImageSlice( out, NULL,
+                         image,
+                         maskS8, 1,
+                         c/10, r/10,
+                         c/10+1, r/10+1,
+                         PS_CUT_X_POS,
+                         stat);
+    if ( out != NULL ) {
+        psError( __func__, "Mask invalid type didn't return NULL as expected.");
+        return 111;
+    }
+
+    /* Verify the input image is an invalid type */
+    psLogMsg( __func__, PS_LOG_INFO, "Following should be an error invalid image type.");
+    out = psImageSlice( out, NULL,
+                        imgU8,
+                        mask, 1,
+                        c/10, r/10,
+                        c/10+1, r/10+1,
+                        PS_CUT_X_POS,
+                        stat);
+    if ( out != NULL ) {
+        psError( __func__, "Input image with invalid type didn't return NULL as expected.");
+        return 112;
+    }
+
     psFree( image );
     psFree( positions );
@@ -287,4 +342,7 @@
     psFree( out );
     psFree( stat );
+    psFree( imgU8 );
+    psFree( maskS8 );
+    psFree( maskSz );
 
     return 0;
