What does the tester code do with the static methods()?
- Tests the randomize() static method to make sure that it scrambles the
formal parameter list in a random manner. In particular a list with 1000
elements is randomized. A check is then made to see that most of the elements
have swapped locations.
- Tests the copy2DArray() to make sure that a deep copy of the formal
parameter is returns. The checking ensures that all of the corresponding
original and duplicate elements return true when tested with the equals()
method. Also makes sure that each row of the 2D arrays has its own storage.
What does the tester code with Pixelator instance (member) methods?
- Tests the various Pixelator instance (member) methods under a variety of
conditions making sure that the methods behaved as expected under those
connections. These conditions require for some of the methods that the other
methods be working properly
getImageHeight()
- Tester makes sure the height is reported correctly after construction (the
value should be 0)
Tester makes sure the height is correct after a beginFade() invocation (the
value should be the height of the initial image)
getImageWidth()
- Tester makes sure the width is reported correctly after construction (the
value should be 0)
- Tester makes sure the width is correct after a beginFade() invocation (the
value should be the width of the initial image)
constructCompletes()
- Returns true if your constructor code does not blow up, otherwise it
returns false
constructorWorks()
- Checks to make sure that getImage() returns null after a construction
- Checks to make sure canIncreaseFade() returns false. If canIncreaseFade()
does not work, then its problem can cause the constructor to appear not to
work
beginFadeWorks()
- Performs a construction and a beginFade(). It then makes sure that
getImage() returns a copy of the initial image. It also makes sure that
canIncreaseFade() now returns true.
stopFadeWorks()
- Performs a construction, a beginFade(), and then a stopFade(). It then
makes sure that getImage() returns null. It also makes sure that
canIncreaseFade() now returns false.
getImageWorks()
- Makes sure that getImage() works correctly at different fading points.
- Begins with a construction and a getImage(). It then makes sure that the
getImage() result is null.
- Next performs a beginFade(). It then makes sure that getImage() returns a
copy of the initial image.
- Finally performs a 100% fade increase. It then makes sure that the
getImage() returns a copy of the final image.
canIncreaseFadeWorks()
- It first makes sure that canIncreaseFade() returns false after a
construction.
- Next a beginFade() is performed and a check to make sure that
canIncreaseFade() returns true at this point.
- Next a unitFadeIncrease() is performed and a check to make sure
canIncreaseFade() still returns true.
- Finally a stopFade() is performed and a check that makes sure that
canIncreaseFade() now returns false.
unitFadeIncreaseWorks()
- Makes sure that unitFadeIncrease() works correctly at different fading
points.
- Begins with construction and a unitFadeIncrease(). It then makes sure that
getImage() returns null.
- Next performs a beginFade() and makes sure that the out image returns by
getImage() is a copy of the initial image.
- Next it performs a series of unitFade() increases. After each increase, a
check is performed to make sure that the out image returns by getImage() is
becoming closer to being the final image.
percentageFadeIncreaseWorks()
- Begins with a construction and a beginFade(). It then makes eleven 10%
fade increases. It makes sure along the way that the percentage fade increases
are closer and closer to the final image.