image_page_unittest.cpp

Go to the documentation of this file.
00001 /*
00002  * File Name: image_page_unittest.cpp
00003  */
00004 
00005 /*
00006  * This file is part of uds-plugin-images.
00007  *
00008  * uds-plugin-images is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * uds-plugin-images is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 /**
00023  * Copyright (C) 2008 iRex Technologies B.V.
00024  * All rights reserved.
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 
Generated by  doxygen 1.6.2-20100208