images_scanner_unittest.cpp

Go to the documentation of this file.
00001 /*
00002  * File Name: images_scanner_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 <iostream>
00028 #include <glib.h>
00029 #include <glib-object.h>
00030 #include "images_scanner.h"
00031 #include "log.h"
00032 
00033 using namespace images;
00034 
00035 void test_ImagesScanner(void)
00036 {
00037     LOGPRINTF("BEGIN-->test_ImagesScanner");
00038 
00039     g_type_init();
00040 
00041     const char * path_list[] = {
00042     "/data/wa/uds/yehong/sample/rome.jpg",
00043 //    "/data/wa/uds/yehong/example1",
00044 //    "/data/wa/uds/yehong/example1/",
00045 //    "rome.jpg",
00046 //    "*.jpg",
00047 //    "/data/wa/uds/yehong/sample/",
00048 //    "/data/wa/uds/yehong/sample/a.b.c",
00049 //    "/data/wa/uds/yehong/sample",
00050 //    "*.*",
00051 //    ".",
00052 //    "./sample/c.b.a",
00053 //    "/data/wa/uds/trunk/sample/Pisa1.JPG",
00054 //    "/usr/share"
00055     };
00056    
00057     ImagesScanner scanner;
00058     Images images;
00059     
00060     int n_cases = sizeof(path_list) / sizeof(path_list[0]);
00061     for (int j = 0; j < n_cases; j++)
00062     {
00063         // Clear the last scan results.
00064         ImagesIter begin = images.begin();
00065         ImagesIter end   = images.end();
00066         for(ImagesIter iter = begin; iter != end; ++iter)
00067         {
00068             delete *iter;
00069         }
00070         images.clear();
00071 
00072         /*
00073         int n_active = scanner.scan_images(path_list[j],
00074                                            true,
00075                                            true, 
00076                                            BY_SIZE,
00077                                            false,
00078                                            images);
00079         LOGPRINTF("%d", n_active);
00080         */
00081         
00082         int n_images = images.size();
00083         LOGPRINTF("%d", n_images);
00084 
00085         for (int i = 0; i < n_images; i++)
00086         {
00087             LOGPRINTF("%s", images[i]->path.c_str());
00088         }
00089     }
00090 
00091     LOGPRINTF("END-->test_ImagesScanner");
00092 }
00093 
00094 int main()
00095 {
00096     test_ImagesScanner();
00097     return 0;
00098 }
00099 
00100 
Generated by  doxygen 1.6.2-20100208