Examples of BandedSampleModel


Examples of java.awt.image.BandedSampleModel

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    b.setElem(0, 0, 0xA0);
    b.setElem(0, 1, 0xA1);
    b.setElem(0, 2, 0xA2);
    b.setElem(0, 3, 0xA3);
    b.setElem(0, 4, 0xA4);
    b.setElem(0, 5, 0xA5);
    b.setElem(1, 0, 0xB0);
    b.setElem(1, 1, 0xB1);
    b.setElem(1, 2, 0xB2);
    b.setElem(1, 3, 0xB3);
    b.setElem(1, 4, 0xB4);
    b.setElem(1, 5, 0xB5);
    harness.check(m.getSample(0, 0, 0, b), 0xA0);
    harness.check(m.getSample(1, 0, 0, b), 0xA1);
    harness.check(m.getSample(0, 1, 0, b), 0xA2);
    harness.check(m.getSample(1, 1, 0, b), 0xA3);
    harness.check(m.getSample(0, 2, 0, b), 0xA4);
    harness.check(m.getSample(1, 2, 0, b), 0xA5);
    harness.check(m.getSample(0, 0, 1, b), 0xB0);
    harness.check(m.getSample(1, 0, 1, b), 0xB1);
    harness.check(m.getSample(0, 1, 1, b), 0xB2);
    harness.check(m.getSample(1, 1, 1, b), 0xB3);
    harness.check(m.getSample(0, 2, 1, b), 0xB4);
    harness.check(m.getSample(1, 2, 1, b), 0xB5);
   
    // try negative x
    boolean pass = false;
    try
    {
      /* int sample = */ m.getSample(-1, 0, 0, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // try negative y
    pass = false;
    try
    {
      /* int sample = */ m.getSample(0, -1, 0, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);
 
    // try negative band
    pass = false;
    try
    {
      /* int sample = */ m.getSample(0, 0, -1, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);
   
    // try null buffer
    pass = false;
    try
    {
        /* int sample = */ m.getSample(0, 0, 0, null);  
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.BandedSampleModel

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    b.setElem(0, 0, 0xA0);
    b.setElem(0, 1, 0xA1);
    b.setElem(0, 2, 0xA2);
    b.setElem(0, 3, 0xA3);
    b.setElem(0, 4, 0xA4);
    b.setElem(0, 5, 0xA5);
    b.setElem(1, 0, 0xB0);
    b.setElem(1, 1, 0xB1);
    b.setElem(1, 2, 0xB2);
    b.setElem(1, 3, 0xB3);
    b.setElem(1, 4, 0xB4);
    b.setElem(1, 5, 0xB5);
    harness.check(m.getPixel(0, 0, (int[]) null, b)[0], 0xA0);
    harness.check(m.getPixel(1, 0, (int[]) null, b)[0], 0xA1);
    harness.check(m.getPixel(0, 1, (int[]) null, b)[0], 0xA2);
    harness.check(m.getPixel(1, 1, (int[]) null, b)[0], 0xA3);
    harness.check(m.getPixel(0, 2, (int[]) null, b)[0], 0xA4);
    harness.check(m.getPixel(1, 2, (int[]) null, b)[0], 0xA5);
    harness.check(m.getPixel(0, 0, (int[]) null, b)[1], 0xB0);
    harness.check(m.getPixel(1, 0, (int[]) null, b)[1], 0xB1);
    harness.check(m.getPixel(0, 1, (int[]) null, b)[1], 0xB2);
    harness.check(m.getPixel(1, 1, (int[]) null, b)[1], 0xB3);
    harness.check(m.getPixel(0, 2, (int[]) null, b)[1], 0xB4);
    harness.check(m.getPixel(1, 2, (int[]) null, b)[1], 0xB5);
    // try negative x
    boolean pass = false;
    try
    {
      /* int[] pixel = */ m.getPixel(-1, 0, (int[]) null, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // try negative y
    pass = false;
    try
    {
      /* int[] pixel = */ m.getPixel(0, -1, (int[]) null, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // try pixel array too small
    pass = false;
    try
    {
      /* int[] pixel = */ m.getPixel(0, 0, new int[1], b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);
   
    // try null buffer
    pass = false;
    try
    {
      /* int[] pixel = */ m.getPixel(0, 0, (int[]) null, null);  
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.BandedSampleModel

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    harness.checkPoint("(int, int, int, int, DataBuffer)");
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    m.setDataElements(0, 0, new int[] {0xA0, 0xB0}, b);
    m.setDataElements(1, 0, new int[] {0xA1, 0xB1}, b);
    m.setDataElements(0, 1, new int[] {0xA2, 0xB2}, b);
    m.setDataElements(1, 1, new int[] {0xA3, 0xB3}, b);
    m.setDataElements(0, 2, new int[] {0xA4, 0xB4}, b);
    m.setDataElements(1, 2, new int[] {0xA5, 0xB5}, b);
    harness.check(b.getElem(0, 0), 0xA0);
    harness.check(b.getElem(0, 1), 0xA1);
    harness.check(b.getElem(0, 2), 0xA2);
    harness.check(b.getElem(0, 3), 0xA3);
    harness.check(b.getElem(0, 4), 0xA4);
    harness.check(b.getElem(0, 5), 0xA5);
    harness.check(b.getElem(1, 0), 0xB0);
    harness.check(b.getElem(1, 1), 0xB1);
    harness.check(b.getElem(1, 2), 0xB2);
    harness.check(b.getElem(1, 3), 0xB3);
    harness.check(b.getElem(1, 4), 0xB4);
    harness.check(b.getElem(1, 5), 0xB5) ;
    // check negative x
    boolean pass = false;
    try
    {
      m.setDataElements(-1, 0, new int[] {0xA0, 0xB0}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check negative y
    pass = false;
    try
    {
      m.setDataElements(0, -1, new int[] {0xA0, 0xB0}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check elements too short
    pass = false;
    try
    {
      m.setDataElements(0, 1, new int[] {0xA0}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null elements
    pass = false;
    try
    {
      m.setDataElements(0, 1, null, b);
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null buffer
    pass = false;
    try
    {
      m.setDataElements(0, 0, new int[] {0xA0, 0xB0}, null);  
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.BandedSampleModel

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    m.setPixels(0, 0, 1, 3, new int[] {0xA0, 0xB0, 0xA2, 0xB2, 0xA4, 0xB4}, b);
    m.setPixels(1, 0, 1, 3, new int[] {0xA1, 0xB1, 0xA3, 0xB3, 0xA5, 0xB5}, b);
    harness.check(b.getElem(0, 0), 0xA0);
    harness.check(b.getElem(0, 1), 0xA1);
    harness.check(b.getElem(0, 2), 0xA2);
    harness.check(b.getElem(0, 3), 0xA3);
    harness.check(b.getElem(0, 4), 0xA4);
    harness.check(b.getElem(0, 5), 0xA5);
    harness.check(b.getElem(1, 0), 0xB0);
    harness.check(b.getElem(1, 1), 0xB1);
    harness.check(b.getElem(1, 2), 0xB2);
    harness.check(b.getElem(1, 3), 0xB3);
    harness.check(b.getElem(1, 4), 0xB4);
    harness.check(b.getElem(1, 5), 0xB5);

    // check negative x
    boolean pass = false;
    try
    {
     m.setPixels(-1, 0, 1, 3, new int[] {0xA0, 0xB0, 0xA2, 0xB2, 0xA4, 0xB4}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check negative y
    pass = false;
    try
    {
      m.setPixels(0, -1, 1, 3, new int[] {0xA0, 0xB0, 0xA2, 0xB2, 0xA4, 0xB4}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check pixel array too short
    pass = false;
    try
    {
      m.setPixels(0, 0, 1, 3, new int[] {0xA0, 0xB0, 0xA2, 0xB2, 0xA4,/*0xB4*/}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null pixel array
    pass = false;
    try
    {
      m.setPixels(0, 0, 1, 3, (int[]) null, b);
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null buffer
    pass = false;
    try
    {
      m.setPixels(0, 0, 1, 3, new int[] {0xA0, 0xB0, 0xA2, 0xB2, 0xA4, 0xB4}, null);
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.BandedSampleModel

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    m.setSamples(0, 0, 1, 3, 0, new int[] {0xA0, 0xA2, 0xA4}, b);
    m.setSamples(1, 0, 1, 1, 0, new int[] {0xA1}, b);
    m.setSamples(1, 1, 1, 2, 0, new int[] {0xA3, 0xA5}, b);
    m.setSamples(0, 0, 1, 3, 1, new int[] {0xB0, 0xB2, 0xB4}, b);
    m.setSamples(1, 0, 1, 3, 1, new int[] {0xB1, 0xB3, 0xB5}, b);
    harness.check(b.getElem(0, 0), 0xA0)// check 1
    harness.check(b.getElem(0, 1), 0xA1)// check 2
    harness.check(b.getElem(0, 2), 0xA2)// check 3
    harness.check(b.getElem(0, 3), 0xA3)// check 4
    harness.check(b.getElem(0, 4), 0xA4)// check 5
    harness.check(b.getElem(0, 5), 0xA5)// check 6
    harness.check(b.getElem(1, 0), 0xB0)// check 7
    harness.check(b.getElem(1, 1), 0xB1)// check 8
    harness.check(b.getElem(1, 2), 0xB2)// check 9
    harness.check(b.getElem(1, 3), 0xB3)// check 10
    harness.check(b.getElem(1, 4), 0xB4)// check 11
    harness.check(b.getElem(1, 5), 0xB5)// check 12

    // check negative x
    boolean pass = false;
    try
    {
      m.setSamples(-1, 0, 0, 3, 0, new int[] {0xA0, 0xA2, 0xA4}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);                   // check 13

    // check negative y
    pass = false;
    try
    {
      m.setSamples(0, -1, 0, 3, 0, new int[] {0xA0, 0xA2, 0xA4}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);                   // check 14

    // check negative band
    pass = false;
    try
    {
      m.setSamples(0, 0, 1, 3, -1, new int[] {0xA0, 0xA2, 0xA4}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check sample array too short
    pass = false;
    try
    {
      m.setSamples(0, 0, 1, 3, -1, new int[] {0xA0, 0xA2, /*0xA4*/}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null sample array
    pass = false;
    try
    {
      m.setSamples(0, 0, 1, 3, 0, (int[]) null, b);
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null buffer
    pass = false;
    try
    {
      m.setSamples(0, 0, 1, 3, 0, new int[] {0xA0, 0xA2, 0xA4}, null);
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.BandedSampleModel

  }

  public void testInt(TestHarness harness)       
  {
    harness.checkPoint("(int, int, int, int, DataBuffer)");
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    m.setSample(0, 0, 0, 0xA0, b);
    m.setSample(1, 0, 0, 0xA1, b);
    m.setSample(0, 1, 0, 0xA2, b);
    m.setSample(1, 1, 0, 0xA3, b);
    m.setSample(0, 2, 0, 0xA4, b);
    m.setSample(1, 2, 0, 0xA5, b);
    m.setSample(0, 0, 1, 0xB0, b);
    m.setSample(1, 0, 1, 0xB1, b);
    m.setSample(0, 1, 1, 0xB2, b);
    m.setSample(1, 1, 1, 0xB3, b);
    m.setSample(0, 2, 1, 0xB4, b);
    m.setSample(1, 2, 1, 0xB5, b);
    harness.check(b.getElem(0, 0), 0xA0);
    harness.check(b.getElem(0, 1), 0xA1);
    harness.check(b.getElem(0, 2), 0xA2);
    harness.check(b.getElem(0, 3), 0xA3);
    harness.check(b.getElem(0, 4), 0xA4);
    harness.check(b.getElem(0, 5), 0xA5);
    harness.check(b.getElem(1, 0), 0xB0);
    harness.check(b.getElem(1, 1), 0xB1);
    harness.check(b.getElem(1, 2), 0xB2);
    harness.check(b.getElem(1, 3), 0xB3);
    harness.check(b.getElem(1, 4), 0xB4);
    harness.check(b.getElem(1, 5), 0xB5);
   
    // check negative x
    boolean pass = false;
    try
    {
      m.setSample(-1, 0, 0, 0xFF, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check negative y
    pass = false;
    try
    {
      m.setSample(0, -1, 0, 0xFF, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);
 
    // check negative band
    pass = false;
    try
    {
      m.setSample(0, 0, -1, 0xFF, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null buffer
    pass = false;
    try
    {
      m.setSample(0, 0, 0, 0xFF, null);  
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.BandedSampleModel

  }

  public void testFloat(TestHarness harness)       
  {
    harness.checkPoint("(int, int, int, float, DataBuffer)");
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    m.setSample(0, 0, 0, (float) 0xA0, b);
    m.setSample(1, 0, 0, (float) 0xA1, b);
    m.setSample(0, 1, 0, (float) 0xA2, b);
    m.setSample(1, 1, 0, (float) 0xA3, b);
    m.setSample(0, 2, 0, (float) 0xA4, b);
    m.setSample(1, 2, 0, (float) 0xA5, b);
    m.setSample(0, 0, 1, (float) 0xB0, b);
    m.setSample(1, 0, 1, (float) 0xB1, b);
    m.setSample(0, 1, 1, (float) 0xB2, b);
    m.setSample(1, 1, 1, (float) 0xB3, b);
    m.setSample(0, 2, 1, (float) 0xB4, b);
    m.setSample(1, 2, 1, (float) 0xB5, b);
    harness.check(b.getElem(0, 0), 0xA0);
    harness.check(b.getElem(0, 1), 0xA1);
    harness.check(b.getElem(0, 2), 0xA2);
    harness.check(b.getElem(0, 3), 0xA3);
    harness.check(b.getElem(0, 4), 0xA4);
    harness.check(b.getElem(0, 5), 0xA5);
    harness.check(b.getElem(1, 0), 0xB0);
    harness.check(b.getElem(1, 1), 0xB1);
    harness.check(b.getElem(1, 2), 0xB2);
    harness.check(b.getElem(1, 3), 0xB3);
    harness.check(b.getElem(1, 4), 0xB4);
    harness.check(b.getElem(1, 5), 0xB5);
   
    // check negative x
    boolean pass = false;
    try
    {
      m.setSample(-1, 0, 0, (float) 0xFF, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check negative y
    pass = false;
    try
    {
      m.setSample(0, -1, 0, (float) 0xFF, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);
 
    // check negative band
    pass = false;
    try
    {
      m.setSample(0, 0, -1, (float) 0xFF, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null buffer
    pass = false;
    try
    {
      m.setSample(0, 0, 0, (float) 0xFF, null);  
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.BandedSampleModel

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void testDouble(TestHarness harness)       
  {
    harness.checkPoint("(int, int, int, double, DataBuffer)");
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    m.setSample(0, 0, 0, (double) 0xA0, b);
    m.setSample(1, 0, 0, (double) 0xA1, b);
    m.setSample(0, 1, 0, (double) 0xA2, b);
    m.setSample(1, 1, 0, (double) 0xA3, b);
    m.setSample(0, 2, 0, (double) 0xA4, b);
    m.setSample(1, 2, 0, (double) 0xA5, b);
    m.setSample(0, 0, 1, (double) 0xB0, b);
    m.setSample(1, 0, 1, (double) 0xB1, b);
    m.setSample(0, 1, 1, (double) 0xB2, b);
    m.setSample(1, 1, 1, (double) 0xB3, b);
    m.setSample(0, 2, 1, (double) 0xB4, b);
    m.setSample(1, 2, 1, (double) 0xB5, b);
    harness.check(b.getElem(0, 0), 0xA0);
    harness.check(b.getElem(0, 1), 0xA1);
    harness.check(b.getElem(0, 2), 0xA2);
    harness.check(b.getElem(0, 3), 0xA3);
    harness.check(b.getElem(0, 4), 0xA4);
    harness.check(b.getElem(0, 5), 0xA5);
    harness.check(b.getElem(1, 0), 0xB0);
    harness.check(b.getElem(1, 1), 0xB1);
    harness.check(b.getElem(1, 2), 0xB2);
    harness.check(b.getElem(1, 3), 0xB3);
    harness.check(b.getElem(1, 4), 0xB4);
    harness.check(b.getElem(1, 5), 0xB5);
   
    // check negative x
    boolean pass = false;
    try
    {
      m.setSample(-1, 0, 0, (double) 0xFF, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check negative y
    pass = false;
    try
    {
      m.setSample(0, -1, 0, (double) 0xFF, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);
 
    // check negative band
    pass = false;
    try
    {
      m.setSample(0, 0, -1, (double) 0xFF, b);  
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null buffer
    pass = false;
    try
    {
      m.setSample(0, 0, 0, (double) 0xFF, null);  
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.BandedSampleModel

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    b.setElem(0, 0, 0xA0);
    b.setElem(0, 1, 0xA1);
    b.setElem(0, 2, 0xA2);
    b.setElem(0, 3, 0xA3);
    b.setElem(0, 4, 0xA4);
    b.setElem(0, 5, 0xA5);
    b.setElem(1, 0, 0xB0);
    b.setElem(1, 1, 0xB1);
    b.setElem(1, 2, 0xB2);
    b.setElem(1, 3, 0xB3);
    b.setElem(1, 4, 0xB4);
    b.setElem(1, 5, 0xB5);
    int[] elements = (int[]) m.getDataElements(1, 1, null, b);
    harness.check(elements[0], 0xA3);
    harness.check(elements[1], 0xB3);
 
    // check negative x
    boolean pass = false;
    try
    {
      /* elements = (int[]) */ m.getDataElements(-1, 1, null, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);
    // check negative y
    pass = false;
    try
    {
      /* elements = (int[]) */ m.getDataElements(1, -1, null, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);
 
    // check null data buffer
    pass = false;
    try
    {
      /* elements = (int[]) */ m.getDataElements(1, 1, null, null);
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.BandedSampleModel

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    m.setPixel(0, 0, new int[] {0xA0, 0xB0}, b);
    m.setPixel(1, 0, new int[] {0xA1, 0xB1}, b);
    m.setPixel(0, 1, new int[] {0xA2, 0xB2}, b);
    m.setPixel(1, 1, new int[] {0xA3, 0xB3}, b);
    m.setPixel(0, 2, new int[] {0xA4, 0xB4}, b);
    m.setPixel(1, 2, new int[] {0xA5, 0xB5}, b);
    harness.check(b.getElem(0, 0), 0xA0);
    harness.check(b.getElem(0, 1), 0xA1);
    harness.check(b.getElem(0, 2), 0xA2);
    harness.check(b.getElem(0, 3), 0xA3);
    harness.check(b.getElem(0, 4), 0xA4);
    harness.check(b.getElem(0, 5), 0xA5);
    harness.check(b.getElem(1, 0), 0xB0);
    harness.check(b.getElem(1, 1), 0xB1);
    harness.check(b.getElem(1, 2), 0xB2);
    harness.check(b.getElem(1, 3), 0xB3);
    harness.check(b.getElem(1, 4), 0xB4);
    harness.check(b.getElem(1, 5), 0xB5);
    // check negative x
    boolean pass = false;
    try
    {
      m.setPixel(-1, 0, new int[] {0xA0, 0xB0}, b)
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check negative y
    pass = false;
    try
    {
      m.setPixel(0, -1, new int[] {0xA0, 0xB0}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check pixel array too short
    pass = false;
    try
    {
      m.setPixel(0, 0, new int[] {0xA0}, b);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null pixel array
    pass = false;
    try
    {
      m.setPixel(0, 0, (int[]) null, b);  
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check null buffer
    pass = false;
    try
    {
      m.setPixel(0, 0, new int[] {0xA0}, null);  
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.