image_page_unittest.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <cassert>
00028 #include <iostream>
00029 #include "image_page.h"
00030 #include "log.h"
00031
00032 using namespace images;
00033
00034 int main()
00035 {
00036 ImagePage *page, *left_page, *right_page;
00037
00038 LOGPRINTF("====BEGIN test operator()====");
00039 ImagePageAttrs attrs;
00040 page = new ImagePage("/data/wa/uds/trunk/sample/Vatican1.png", attrs);
00041 size_t key = (*page)();
00042 LOGPRINTF("key = %d", key);
00043 delete page;
00044
00045 LOGPRINTF("Change render attributes.");
00046 attrs.zoom = -1;
00047 attrs.rotation = Clockwise_Degrees_90;
00048 page = new ImagePage("/data/wa/uds/trunk/sample/Vatican1.png", attrs);
00049 key = (*page)();
00050 LOGPRINTF("key = %d", key);
00051 delete page;
00052
00053 LOGPRINTF("Changing the anchor.");
00054 page = new ImagePage("/data/wa/uds/trunk/sample/Vatican2.png", attrs);
00055 key = (*page)();
00056 LOGPRINTF("key = %d", key);
00057
00058 LOGPRINTF("No changes.");
00059 key = (*page)();
00060 LOGPRINTF("key = %d", key);
00061 delete page;
00062 LOGPRINTF("====END test operator()====");
00063
00064 LOGPRINTF("====BEGIN test operator == < > ====");
00065 attrs.zoom = -2;
00066 attrs.rotation = Clockwise_Degrees_270;
00067 left_page = new ImagePage("/data/wa/uds/trunk/sample/Pisa1.png", attrs);
00068 attrs.zoom = -2;
00069 attrs.rotation = Clockwise_Degrees_270;
00070 right_page = new ImagePage("/data/wa/uds/trunk/sample/Pisa1.png", attrs);
00071
00072 LOGPRINTF("== %d", (left_page == right_page));
00073 LOGPRINTF("< %d", (left_page < right_page));
00074 LOGPRINTF("> %d", (left_page > right_page));
00075 delete left_page;
00076 delete right_page;
00077 LOGPRINTF("====END test operator==< > ====");
00078
00079 LOGPRINTF("====BEGIN test length()====");
00080 page = new ImagePage("/data/wa/uds/trunk/sample/Pisa1.png", attrs);
00081 LOGPRINTF("page.length = %d", page->length());
00082 delete page;
00083 LOGPRINTF("====END test operator length()====");
00084
00085 return 0;
00086 }
00087
00088