Corrupted Pictures in Paint

 


Summary

When saving files in Microsoft's Paint, the user is allowed to type in the file extension that they would like the file to be saved as. However, the file will be corrupted if the typed-in file extension does not match the file extension selected in the 'Save As' option field.


Application Description

Microsoft Paint is a basic drawing and picture editing program provided with the Windows operating system. Microsoft describes Paint as "a drawing tool you can use to create black-and-white or color drawings that you can save as bitmap (.bmp) files. You can also use Paint to send your drawing in e-mail, set the image as a desktop background, and save image files using different file formats."


Test Design

This example demonstrates the use of Scenario testing. In scenario testing, we create a hypothetical situation the program could be run through, and then we run through it ourselves based on that situation. This helps us to evaluate the program's real-world adaptibility, as well as help us to test many functions that are not frequently used or tested (or simply aren't tested thoroughly enough).

For this presentation, let's imagine we are web designers. We are creating and saving images in Microsoft Paint to place on our webpage. We are very busy so we use any trick we can to save time. One trick that we employ is that when saving a file that we have just created in paint, rather than typing the file name, then selecting the file type, and then saving the file type with a lower case extension, we simply type in the file extension ourselves. For example, we just type in picture.jpg instead, a much quicker solution.

We expect that our file will be saved correctly (or if it is not, that we will be informed) even though we have not selected the file extension from the drop-down list.

We are using Scenario testing to tackle file saving because we want to verify that this function performs how a user would expect it to. We want to ensure that it saves the file intuitively, meaning that it interprets more how we want the file to be saved, rather than simply looking at what the overriding setting is and defaulting to that.


Performing the Test

  1. Open Microsoft Paint.
  2. Create a new picture file by using File->New or by pressing Ctrl-N.
  3. Draw anything in the drawing area:

  4. Once our masterpiece is created, we should save the file using File->Save As or Ctrl-S:

  5. We want our picture to be a JPEG file, so in the essence of saving time, we will type in the name of our file followed by .jpg to designate it as a JPEG file:

    Notice that in the "Save as type" drop-down box, it says "24-bit Bitmap", which is a file of type .bmp. This is not the type of file we want, but we are hoping that since we are typing in .jpg, we do not have to change the drop-down box to say "JPEG".

  6. Press the 'Save' button to save the picture:

  7. Now, let's verify that the picture was saved as a .jpg file and that it works correctly. Navigate to the folder where the picture is saved.
  8. Once inside the folder, right click on the picture and choose Properties:

    The picture appears correctly named and in 'Type of file' it says "JPEG Image", which is what we wanted. However, the properties for file size are questionable. The typical JPEG image is about 10-15 kilobytes. This file, a simple plain white image with some green lines, is listed as being 183 kilobytes (a common size for a Bitmap image).

  9. Due to the filesize that more resembles a Bitmap image's, we should see if the image launches and displays correctly. Open Macromedia Dreamweaver, a webpage creation program that we can use to place an image on a webpage.
  10. Use Insert->Image or Ctrl-Alt-I to insert an image into a new webpage.
  11. Locate the image we have just created and select it as the graphic to be inserted:

    Our picture is listed as a .jpg file, but Dreamweaver is unable to generate an Image Preview for us.

  12. Click the 'Select' button to insert our image into the webpage.

Results/Relevance

After clicking 'Select' to insert the image, we returned to our webpage and, instead of seeing our image on the page, we see a picture of a broken image icon. This means that Dreamweaver is unable to display the image because either the image was not found in the specified location (which it was) or the image file is corrupted.

Unfortunately, despite the correct file extension, it appears as if Paint still saved the file in the Bitmap format, even though we specified the file as a JPEG. Had we been working on an important image file, we would have come into some very serious problems, with the main question being "Can our image file be salvaged/rescued?".

This bug was very misleading because until we placed this image into a different program, we would never have been made aware of the corrupted file structure. There were no warnings that how we saved the file was invalid, no error messages informing us of the error during the save, and no errors in the image properties (except for an unusual file size that would have gone unnoticed had we not been specifically looking for it). In fact, this bug could very well have gone entirely unnoticed had we not tried to insert this graphic into a webpage.

Scenario testing helped us to locate this bug where we might have otherwise not noticed any problem at all. By creating a scenario that was believable and likely, we located a bug that could cause many problems for users.


Similar Tests/Additional Notes

Since Microsoft Paint is a very basic program, it is an excellent choice with which to practice testing techniques because applying the theories may be more readily obvious than in more complex programs.


Configuration Notes

Testing Microsoft's Paint v5.1 on:


Created 21 July 2004 for the CSTER

All images and written material ©Copyright Sam Oswald 2004

This work is licensed under the Creative Commons Attribution-ShareAlike License.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/2.0/
or send a letter to
Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305,
USA.