File: UnitTest.cpp

package info (click to toggle)
devil 1.6.8-rc2-3%2Blenny1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 10,004 kB
  • ctags: 4,659
  • sloc: ansic: 37,357; sh: 13,641; cpp: 7,193; pascal: 792; makefile: 348; python: 47
file content (76 lines) | stat: -rw-r--r-- 1,693 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// UnitTest.cpp : Defines the entry point for the console application.
//

#include <IL/il.h>
#include <IL/ilu.h>
#include <assert.h>
#include <IL/ilut.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>

void TestGenerate()
{

  ILuint lImages[5];
  ilInit();
  iluInit();

  ilGenImages(5, lImages);
  ilBindImage(lImages[3]);
  ilLoadImage("D:\\rgbrle4.bmp");


  ilBindImage(lImages[4]);
  ilLoadImage("D:\\rgbrle4.bmp");
  iluMirror();


  ilBindImage(lImages[0]);
  ilSaveImage("D:\\Image0.bmp");

  ilBindImage(lImages[1]);
  ilSaveImage("D:\\Image1.bmp");

  ilBindImage(lImages[2]);
  ilSaveImage("D:\\Image2.bmp");

  ilBindImage(lImages[3]);
  ilSaveImage("D:\\Image3.bmp");

  ilBindImage(lImages[4]);
  ilSaveImage("D:\\Image4.bmp");

}

void TestClipboard()
{
  ilInit();
  iluInit();

  FILE * lBuffer = fopen("D:\\result.bmp", "wb");
//  ilutGetWinClipboard();
  ilSaveF(IL_BMP,lBuffer);
  assert(ilGetError() == IL_NO_ERROR);
  fclose(lBuffer);
}


int main(int argc, char* argv[])
{
  // Get the top level suite from the registry
  CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();

  // Adds the test to the list of test to run
  CPPUNIT_NS::TextUi::TestRunner runner;
  runner.addTest( suite );

  // Change the default outputter to a compiler error format outputter
  runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
                                                       std::cerr ) );
  // Run the test.
  bool wasSucessful = runner.run();

  // Return error code 1 if the one of test failed.
  return wasSucessful ? 0 : 1;  
}