Back to index

unity  6.0.0
TestMain.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Canonical Ltd.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License version 3, as published
00006  * by the  Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * version 3 along with this program.  If not, see
00015  * <http://www.gnu.org/licenses/>
00016  *
00017  * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
00018  *
00019  */
00020 
00021 #include "config.h"
00022 #include <glib.h>
00023 #include <glib-object.h>
00024 #include <gtk/gtk.h>
00025 #include "Nux/Nux.h"
00026 #include "Nux/WindowThread.h"
00027 
00028 void TestPanelServiceCreateSuite();
00029 void TestUBusCreateSuite();
00030 void TestQuicklistMenuitemsCreateSuite();
00031 void TestStaticCairoTextCreateSuite();
00032 
00033 nux::WindowThread*
00034 createThread()
00035 {
00036   nux::WindowThread* thread = NULL;
00037 
00038   nux::NuxInitialize(0);
00039   thread = nux::CreateGUIThread(TEXT("Unit-Test Dummy Window"),
00040                                 320,
00041                                 240,
00042                                 0,
00043                                 NULL,
00044                                 0);
00045   return thread;
00046 }
00047 
00048 void
00049 runThread(nux::WindowThread* thread)
00050 {
00051   thread->Run(NULL);
00052 }
00053 
00054 void
00055 stopThread(nux::WindowThread* thread)
00056 {
00057   thread->ExitMainLoop();
00058   delete thread;
00059 }
00060 
00061 int
00062 main(int argc, char** argv)
00063 {
00064   g_setenv("GSETTINGS_SCHEMA_DIR", BUILDDIR"/settings/", TRUE);
00065 
00066   g_type_init();
00067   
00068   gtk_init(&argc, &argv);
00069 
00070   g_test_init(&argc, &argv, NULL);
00071 
00072   //Keep alphabetical please
00073   TestPanelServiceCreateSuite();
00074   TestQuicklistMenuitemsCreateSuite();
00075   TestStaticCairoTextCreateSuite();
00076   TestUBusCreateSuite();
00077 
00078   nux::WindowThread* thread = createThread();
00079 
00080   int ret = g_test_run();
00081 
00082   stopThread(thread);
00083 
00084   return ret;
00085 }
00086