[glom] Add a test to check instantiation of glade widgets.



commit be6128d0bdd9a09d99a7258f0510e0ec925e8eed
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Mar 30 09:41:26 2010 +0200

    Add a test to check instantiation of glade widgets.
    
        * Makefile_tests.am
    * tests/glade_toplevels_instantiation.cc: Added this code for an
        executable that will try to instantiate all GtkWindow and GtkDialog
        objects in a specified .glade file. It also checks that they are not
        visible by default.
    * tests/test_glade_toplevels_instantiation.sh: Added a tests script,
        run during make check, to run this executable on all our .glade files.
    
        * glom/glom.glade, glom_developer.glom: Fix small problems found by the
        test, removing an empty textbuffer top-level object and making all
        top-level objects non-visible by default.

 glom/glom_developer.glade              |    4 ----
 tests/glade_toplevels_instantiation.cc |   15 +++++++--------
 2 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/glom/glom_developer.glade b/glom/glom_developer.glade
index 865ecc6..4f85eb3 100644
--- a/glom/glom_developer.glade
+++ b/glom/glom_developer.glade
@@ -7015,12 +7015,8 @@ Which user should be added to this group?</property>
     </child>
   </object>
   <object class="GtkDialog" id="dialog_relationships_overview">
-<<<<<<< HEAD:glom/glom_developer.glade
-    <property name="visible">True</property>
-=======
     <property name="visible">False</property>
     <property name="border_width">6</property>
->>>>>>> Add a test to check instantiation of glade widgets.:glom/glom_developer.glade
     <property name="title" translatable="yes">Relationships Overview</property>
     <property name="default_width">400</property>
     <property name="default_height">400</property>
diff --git a/tests/glade_toplevels_instantiation.cc b/tests/glade_toplevels_instantiation.cc
index dc85455..db89fe8 100644
--- a/tests/glade_toplevels_instantiation.cc
+++ b/tests/glade_toplevels_instantiation.cc
@@ -58,7 +58,7 @@ static bool attempt_instantiation(const std::string& filepath, const xmlpp::Elem
   else
   {
     //We try to avoid using non-window top-level widgets in Glom.
-    std::cerr << "Non-window top-level object in Glade file (unexpected by Glom): id=" << id << " from file " << filepath << std::endl; 
+    std::cerr << "Non-window top-level object in Glade file (unexpected by Glom): id=" << id << " from file " << filepath << std::endl;
 
     //But let's try this anyway:
     Glib::RefPtr<Glib::Object> object = builder->get_object(id);
@@ -72,7 +72,7 @@ static bool attempt_instantiation(const std::string& filepath, const xmlpp::Elem
     return false;
   }
 
-  //Check that it is not visible by default, 
+  //Check that it is not visible by default,
   //because applications generally want to separate instantiation from showing.
   if(widget->get_visible())
   {
@@ -99,18 +99,18 @@ int main(int argc, char* argv[])
     std::cerr << "Usage: glade_toplevels_instantiation filepath" << std::endl;
     return -1;
   }
-  
+
   #ifdef LIBXMLCPP_EXCEPTIONS_ENABLED
   try
   {
-  #endif //LIBXMLCPP_EXCEPTIONS_ENABLED 
+  #endif //LIBXMLCPP_EXCEPTIONS_ENABLED
     xmlpp::DomParser parser;
     //parser.set_validate();
     parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
     parser.parse_file(filepath);
     if(!parser)
       return -1;
-    
+
     const xmlpp::Node* root = parser.get_document()->get_root_node(); //deleted by DomParser.
     if(!root)
       return -1;
@@ -124,15 +124,14 @@ int main(int argc, char* argv[])
        if(child && !attempt_instantiation(filepath, child))
          return -1;
     }
-    
+
   #ifdef LIBXMLCPP_EXCEPTIONS_ENABLED
   }
   catch(const std::exception& ex)
   {
     std::cout << "Exception caught: " << ex.what() << std::endl;
   }
-  #endif //LIBXMLCPP_EXCEPTIONS_ENABLED 
+  #endif //LIBXMLCPP_EXCEPTIONS_ENABLED
 
   return 0;
 }
-



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]