Index: trunk/psLib/test/imageops/tst_psImageStats.c
===================================================================
--- trunk/psLib/test/imageops/tst_psImageStats.c	(revision 6750)
+++ trunk/psLib/test/imageops/tst_psImageStats.c	(revision 6778)
@@ -634,4 +634,16 @@
     }
 
+    //Test a subimage.
+    reg.y0 = 1;
+    reg.y1 = 5;
+    numPix2 = -1;
+    in2->row0 = 1;
+    numPix2 = psImageCountPixelMask(in2, reg, 1);
+    if (numPix2 != 2) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
+                "psImageCountPixelMask returned incorrect pixel count %ld (!=2)\n", numPix2);
+        return 11;
+    }
+
     psFree(in);
     psFree(in2);
