Add ObjectType for Object Type
[ipdf/code.git] / src / tests / saveload.cpp
1 #include "../common.h"
2
3 #include "../document.h"
4 #include "../view.h"
5 #include "../screen.h"
6
7 using namespace std;
8 using namespace IPDF;
9
10 unsigned test_objects = 4;
11
12 int main(int argc, char ** argv)
13 {
14         srand(time(NULL));
15         Document doc;
16         for (unsigned id = 0; id < test_objects; ++id)
17         {
18                 doc.Add((ObjectType)(rand() % 2), Rect(Random(), Random(), Random(), Random()));
19         }
20         doc.Save("test.ipdf");
21
22         Document equ("test.ipdf");
23         //doc.Add(Random(), Random(), Random(), Random());
24         if (doc != equ || equ != doc)
25         {
26                 Error("Loaded document is not equivelant to saved document!");
27                 doc.DebugDumpObjects();
28                 equ.DebugDumpObjects();
29         }
30         
31
32         View view(doc);
33         Screen scr;
34
35         while (scr.PumpEvents())
36         {
37                 view.Render();
38                 scr.Present();
39         }
40
41         return 0;
42 }

UCC git Repository :: git.ucc.asn.au