[glom] Fix make check by correcting the DTD.



commit ade9e2731a16b4da4eb7c7231f0a9fe8576f6f28
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Oct 28 14:45:56 2011 +0200

    Fix make check by correcting the DTD.
    
    	* glom/glom_document.dtd: Corrections relating to the print layout definitions.

 ChangeLog                                |    6 ++
 glom/glom_document.dtd                   |   24 +++++--
 tests/test_selfhosting_new_then_image.cc |  109 ++++++++++++++++++++++++++++++
 3 files changed, 133 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c6a45be..9dee41b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-10-28  Murray Cumming  <murrayc murrayc com>
 
+	Fix make check by correcting the DTD.
+
+	* glom/glom_document.dtd: Corrections relating to the print layout definitions.
+
+2011-10-28  Murray Cumming  <murrayc murrayc com>
+
 	Small Business Example: Make the report example more like the one in screenshots.
 
 	* examples/example_smallbusiness.glom:
diff --git a/glom/glom_document.dtd b/glom/glom_document.dtd
index af99daa..eaca180 100644
--- a/glom/glom_document.dtd
+++ b/glom/glom_document.dtd
@@ -245,7 +245,7 @@ TODO: Add 'title_singular' element.
 
 <!-- data_layout_text and text are for displaying text. -->
 
-    <!ELEMENT data_layout_text (text?, formatting?)>
+    <!ELEMENT data_layout_text (text?, formatting?, position?)>
     <!ATTLIST data_layout_text
         sequence CDATA #IMPLIED>
 
@@ -307,7 +307,7 @@ TODO: Add 'title_singular' element.
 
 <!-- A data_layout_item is the display of a single field in the layout. -->
 
-    <!ELEMENT data_layout_item (title_custom?, formatting?)>
+    <!ELEMENT data_layout_item (title_custom?, formatting?, position?)>
     <!ATTLIST data_layout_item
         name CDATA #REQUIRED
         relationship CDATA #IMPLIED
@@ -349,7 +349,7 @@ TODO: Add 'title_singular' element.
 
 <!-- A data_layout_portal shows related records -->
 
-    <!ELEMENT data_layout_portal (portal_navigation_relationship?, data_layout_item*) >
+    <!ELEMENT data_layout_portal (portal_navigation_relationship?, data_layout_item*, position?) >
     <!ATTLIST data_layout_portal
         name CDATA #IMPLIED
         relationship CDATA #REQUIRED
@@ -361,7 +361,7 @@ TODO: Add 'title_singular' element.
         line_color CDATA #IMPLIED
         column_line_color CDATA #IMPLIED >
 
- <!ELEMENT data_layout_calendar_portal (portal_navigation_relationship?, data_layout_item*) >
+    <!ELEMENT data_layout_calendar_portal (portal_navigation_relationship?, data_layout_item*) >
     <!ATTLIST data_layout_calendar_portal
         name CDATA #IMPLIED
         relationship CDATA #REQUIRED
@@ -369,6 +369,14 @@ TODO: Add 'title_singular' element.
         sequence CDATA #IMPLIED
         hide CDATA #IMPLIED
         columns_count CDATA #IMPLIED>
+ 
+<!-- The position of a layout item on a print layouts. -->
+    <!ELEMENT position EMPTY>
+    <!ATTLIST position
+        x CDATA #REQUIRED
+        y CDATA #REQUIRED
+        width CDATA #REQUIRED
+        height CDATA #REQUIRED>
 
 <!-- portal_navigation_relationship determines what happens when the user
      activates a row in a related records portal.
@@ -406,15 +414,20 @@ TODO: Add 'title_singular' element.
 
 <!-- print layouts are for perfectly-positioned printing of single record details. -->
     <!ELEMENT print_layouts (print_layout*)>
-    <!ELEMENT print_layout (print_layout_groups, horizontal_rule?, vertical_rule?)>
+
+    <!ELEMENT print_layout (page_setup?, data_layout_groups, horizontal_rule?, vertical_rule?)>
     <!ATTLIST print_layout
         name CDATA #REQUIRED
+        title CDATA #IMPLIED
         parent_table CDATA #IMPLIED
         show_table_title (true|false) "false"
         show_grid (true|false) "false"
         show_rules (true|false) "false"
         show_outlines (true|false) "false"
         page_count CDATA #IMPLIED>
+        
+    <!ELEMENT page_setup (#PCDATA)>
+    <!ATTLIST page_setup>
 
     <!ELEMENT print_layout_groups (print_layout_group*)>
     <!ATTLIST print_layout_groups>
@@ -427,7 +440,6 @@ TODO: Add 'title_singular' element.
     <!ATTLIST vertical_rule
         position CDATA #REQUIRED>
 
-
 <!-- The library_modules node contains python code that may be used in scripts and
      calculations via the python import keyword. -->
 
diff --git a/tests/test_selfhosting_new_then_image.cc b/tests/test_selfhosting_new_then_image.cc
new file mode 100644
index 0000000..c2c81b0
--- /dev/null
+++ b/tests/test_selfhosting_new_then_image.cc
@@ -0,0 +1,109 @@
+/* Glom
+ *
+ * Copyright (C) 2010 Openismus GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+71 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "tests/test_selfhosting_utils.h"
+#include <libglom/init.h>
+#include <libglom/utils.h>
+#include <libglom/db_utils.h>
+#include <glib.h> //For g_assert()
+#include <iostream>
+#include <cstdlib> //For EXIT_SUCCESS and EXIT_FAILURE
+
+static bool test(Glom::Document::HostingMode hosting_mode)
+{
+  Glom::Document document;
+  const bool recreated = 
+    test_create_and_selfhost("example_music_collection.glom", document, hosting_mode);
+  if(!recreated)
+  {
+    std::cerr << "Recreation failed." << std::endl;
+    return false;
+  }
+  
+  //Check that some data is as expected:
+  const Gnome::Gda::Value value("Born To Run");
+  const Gnome::Gda::SqlExpr where_clause = 
+    Glom::Utils::get_find_where_clause_quick(&document, "albums", value);
+  
+  Glom::Utils::type_vecLayoutFields fieldsToGet;
+  Glom::sharedptr<const Glom::Field> field = document.get_field("albums", "album_id");
+  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem->set_full_field_details(field);
+  fieldsToGet.push_back(layoutitem);
+  field = document.get_field("albums", "name");
+  layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem->set_full_field_details(field);
+  fieldsToGet.push_back(layoutitem);
+
+  const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder = 
+    Glom::Utils::build_sql_select_with_where_clause("albums",
+      fieldsToGet, where_clause);
+  Glib::RefPtr<Gnome::Gda::DataModel> data_model = 
+    Glom::DbUtils::query_execute_select(builder);
+  if(!test_model_expected_size(data_model, 2, 1))
+  {
+    std::cerr << "Failure: Unexpected data model size for main query." << std::endl;
+    return false;
+  }
+
+  const int count = Glom::DbUtils::count_rows_returned_by(builder);
+  if(count != 1 )
+  {
+    std::cerr << "Failure: The COUNT query returned an unexpected value: " << count << std::endl;
+    return false;
+  }
+
+  if(!test_table_exists("songs", document))
+  {
+    return false;
+  }
+
+  if(!test_table_exists("publishers", document))
+  {
+    return false;
+  }
+
+  test_selfhosting_cleanup();
+ 
+  return true; 
+}
+
+int main()
+{
+  Glom::libglom_init();
+  
+  if(!test(Glom::Document::HOSTING_MODE_POSTGRES_SELF))
+  {
+    std::cerr << "Failed with PostgreSQL" << std::endl;
+    test_selfhosting_cleanup();
+    return EXIT_FAILURE;
+  }
+  
+  if(!test(Glom::Document::HOSTING_MODE_SQLITE))
+  {
+    std::cerr << "Failed with SQLite" << std::endl;
+    test_selfhosting_cleanup();
+    return EXIT_FAILURE;
+  }
+
+  Glom::libglom_deinit();
+
+  return EXIT_SUCCESS;
+}



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