Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Fix https://github.com/rmtheis/tess-two/issues/159 #267

Merged
merged 1 commit into from
Jul 20, 2019

Conversation

alexcohn
Copy link
Contributor

@alexcohn alexcohn commented Jul 18, 2019

As a result of discussion with @DanBloomberg, the test that was commented out, can now be re-enabled.
The change for Pixa.replacePix() method only concerns the JavaDoc, but is very important. I would suggest to rewrite the test such:

public void testPixaReplacePix() {
    Pixa pixa = Pixa.createPixa(0, 640, 480);

    // Populate the Pixa.
    addBlockToPixa(pixa, 0, 0, 640, 480, 8);

    // Replace the existing Pix.
    pixa.replacePix(0, new Pix(320, 240, 8), new Box(320, 240, 320, 240));

    // Ensure the replacement was successful.
    Pix returnedPix = pixa.getPix(0);
    Box returnedBox = pixa.getBox(0);

    assertEquals(320, returnedPix.getWidth());
    assertEquals(240, returnedPix.getHeight());
    assertEquals(8, returnedPix.getDepth());

    assertEquals(320, returnedBox.getX());
    assertEquals(240, returnedBox.getY());
    assertEquals(320, returnedBox.getWidth());
    assertEquals(240, returnedBox.getHeight());

    returnedPix.recycle();
    returnedBox.recycle();
    pixa.recycle();
}

This should emphasize that the parameters of replacePix method actually become zombies, and should not be recycled or referenced anymore.

fix JavaDoc
enable and fix testPixaReplacePix

see rmtheis#159 (comment)
@rmtheis
Copy link
Owner

rmtheis commented Jul 20, 2019

Nice. Thanks for tracking down the root of the issue here.

@rmtheis rmtheis merged commit c4c8510 into rmtheis:master Jul 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants