| 36 | |
| 37 | |
| 38 | void ILTest::TestilActiveImage() |
| 39 | { |
| 40 | //Must call ilGenImages and ilBindImage for it to work |
| 41 | ilActiveImage(3); |
| 42 | CPPUNIT_ASSERT(ilGetError() == IL_ILLEGAL_OPERATION); |
| 43 | CPPUNIT_ASSERT(ilGetError() == IL_NO_ERROR); |
| 44 | |
| 45 | ILuint MainImage = 0; |
| 46 | ilGenImages(1, &MainImage); |
| 47 | ilBindImage(MainImage); |
| 48 | |
| 49 | //Must have several images in the file |
| 50 | ilLoadImage(".\\Data\\Cardinal.gif"); |
| 51 | |
| 52 | //Number of images must be > 0 |
| 53 | const unsigned int lNumImages = ilGetInteger(IL_NUM_IMAGES); |
| 54 | CPPUNIT_ASSERT(lNumImages > 0); |
| 55 | |
| 56 | //Never an error |
| 57 | ilActiveImage(0); |
| 58 | CPPUNIT_ASSERT(ilGetError() == IL_NO_ERROR); |
| 59 | |
| 60 | //Selects the second picture |
| 61 | ilActiveImage(1); |
| 62 | CPPUNIT_ASSERT(ilGetError() == IL_NO_ERROR); |
| 63 | |
| 64 | //It does not have that many images so error is reported |
| 65 | ilActiveImage(2045); |
| 66 | CPPUNIT_ASSERT(ilGetError() == IL_ILLEGAL_OPERATION); |
| 67 | |
| 68 | //Make a picture of each image. |
| 69 | char lBuffer[4]; |
| 70 | std::string lFilename = ".\\results\\Cardinal"; |
| 71 | std::string lFinalFilename; |
| 72 | for (unsigned int i = 0; i < lNumImages; ++i) |
| 73 | { |
| 74 | ilBindImage(MainImage); |
| 75 | ilActiveImage(i); |
| 76 | itoa (i,lBuffer,10); |
| 77 | lFinalFilename = lFilename + lBuffer + ".bmp"; |
| 78 | FILE * lBuffer = fopen(lFinalFilename.c_str() , "wb"); |
| 79 | CPPUNIT_ASSERT(lBuffer != NULL); |
| 80 | ilSaveF(IL_BMP,lBuffer); |
| 81 | fclose(lBuffer); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | void ILTest::TestilBindImage() |
| 86 | { |
nothing calls this directly
no outgoing calls
no test coverage detected