[glom/glom-1-20] 1.20.8
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-20] 1.20.8
- Date: Tue, 14 Feb 2012 08:02:55 +0000 (UTC)
commit 2f6a0450df698b9441c803f552a9a186e8bab4c9
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Feb 6 14:09:09 2012 +0100
1.20.8
ChangeLog | 2 +
NEWS | 26 +++
configure.ac | 2 +-
glom/utils_ui.cc | 1 +
tests/test_document_load.cc | 2 +-
tests/test_selfhosting_new_then_report.cc | 1 +
tests/test_selfhosting_new_then_report_summary.cc | 3 +-
tests/test_selfhosting_utils.cc | 172 +++++++++++++++------
tests/test_selfhosting_utils.h | 33 ++++-
9 files changed, 189 insertions(+), 53 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fb95708..c514f0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+1.20.8:
+
2012-02-05 Murray Cumming <murrayc murrayc com>
Button scripts and Field Calculations: Test button: Check for pygtk2.
diff --git a/NEWS b/NEWS
index 4d2e3fa..d761c25 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,29 @@
+1.20.8 (stable):
+
+* Button scripts: Check and warn about pygtk2 instead of crashing.
+ This should help with but #669196 (alien) and ##661766 (Andre Klapper) .
+* ReportBuilder:
+ - Make summary fields work again.
+ - Add error checking.
+ Bug #669281 (alien)
+* Users/Groups:
+ - Example files: Really load the table privileges.
+ - Really prevent changing to developer mode for non-developers.
+ Bug #669043 (alien)
+ - Allow user and group names to have spaces and other special characters.
+ Bug #669012 (alien)
+ - Limit user and group name lengths because PostgreSQL seems to have an
+ (undocumented) limit.
+ - Add tests.
+* Database Preferences: Really store the organization name in the database.
+ Bug #668836 (alien)
+* Choices: Allow the field to be be other than the primary key and do not
+ crash if it is not, or if it is hidden.
+ Bug #668759 (alien).
+* Build:
+ - Require the latest goocanvas because it has fixes that PrintLayout needs.
+
+
1.20.7 (stable):
* Depend on libgda 5.0.3 because we need the GdaNumeric corrections.
diff --git a/configure.ac b/configure.ac
index 03571b3..5b201d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,7 +15,7 @@
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([Glom],[1.20.7],[http://bugzilla.gnome.org/enter_bug.cgi?product=Glom],[glom])
+AC_INIT([Glom],[1.20.8],[http://bugzilla.gnome.org/enter_bug.cgi?product=Glom],[glom])
AC_PREREQ(2.63)
AC_CONFIG_SRCDIR([glom/main.cc])
diff --git a/glom/utils_ui.cc b/glom/utils_ui.cc
index 51ae462..473dc94 100644
--- a/glom/utils_ui.cc
+++ b/glom/utils_ui.cc
@@ -24,6 +24,7 @@
#include <libglom/connectionpool.h>
#include <libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.h>
#include <libglom/data_structure/glomconversions.h>
+#include <libglom/utils.h>
#include <libglom/data_structure/layout/layoutitem_image.h> // For GLOM_IMAGE_FORMAT
#include <gdkmm/pixbufloader.h>
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index 22c79e4..4dbc2e1 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -46,7 +46,7 @@ bool contains_named(const T_Container& container, const Glib::ustring& name)
return iter != container.end();
}
-static bool get_group_named(const Glom::Document::type_list_groups& container, const Glib::ustring& name, Glom::GroupInfo& group_info).
+static bool get_group_named(const Glom::Document::type_list_groups& container, const Glib::ustring& name, Glom::GroupInfo& group_info)
{
Glom::Document::type_list_groups::const_iterator iter =
std::find_if(container.begin(), container.end(),
diff --git a/tests/test_selfhosting_new_then_report.cc b/tests/test_selfhosting_new_then_report.cc
index 805d4ca..e22ec59 100644
--- a/tests/test_selfhosting_new_then_report.cc
+++ b/tests/test_selfhosting_new_then_report.cc
@@ -42,6 +42,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
Glom::FoundSet found_set; //TODO: Test a where clause.
found_set.m_table_name = "albums";
+
Glom::ReportBuilder report_builder;
report_builder.set_document(&document);
const Glib::ustring html =
diff --git a/tests/test_selfhosting_new_then_report_summary.cc b/tests/test_selfhosting_new_then_report_summary.cc
index d3f6560..5d331b6 100644
--- a/tests/test_selfhosting_new_then_report_summary.cc
+++ b/tests/test_selfhosting_new_then_report_summary.cc
@@ -48,8 +48,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
Glom::FoundSet found_set; //TODO: Test a where clause.
found_set.m_table_name = "invoices";
- const Glib::ustring locale = ""; /* original locale */
- Glom::ReportBuilder report_builder(locale);
+ Glom::ReportBuilder report_builder;
report_builder.set_document(&document);
const Glib::ustring html =
report_builder.report_build(found_set, report);
diff --git a/tests/test_selfhosting_utils.cc b/tests/test_selfhosting_utils.cc
index 6401fd3..f456adf 100644
--- a/tests/test_selfhosting_utils.cc
+++ b/tests/test_selfhosting_utils.cc
@@ -52,7 +52,13 @@ static void on_cleanup_progress()
//std::cout << "Database cleanup progress" << std::endl;
}
-std::string temp_filepath_dir;
+static void on_db_creation_progress()
+{
+ //std::cout << "Database creation progress" << std::endl;
+}
+
+static std::string temp_filepath_dir; //Remembered so we can delete it later.
+static Glib::ustring temp_file_uri; //Rememered so we can return it sometimes.
static bool check_directory_exists()
{
@@ -110,13 +116,16 @@ static bool delete_directory(const std::string& uri)
return delete_directory(file);
}
-void test_selfhosting_cleanup()
+void test_selfhosting_cleanup(bool delete_file)
{
Glom::ConnectionPool* connection_pool = Glom::ConnectionPool::get_instance();
const bool stopped = connection_pool->cleanup( sigc::ptr_fun(&on_cleanup_progress) );
g_assert(stopped);
+ if(!delete_file)
+ return;
+
//Make sure the directory is removed at the end:
if(!temp_filepath_dir.empty())
{
@@ -136,30 +145,32 @@ void test_selfhosting_cleanup()
}
temp_filepath_dir.clear();
+ temp_file_uri.clear(); //Forget this too.
}
-bool test_create_and_selfhost_from_example(const std::string& example_filename, Glom::Document& document, Glom::Document::HostingMode hosting_mode, const std::string& subdirectory_path)
+bool test_selfhost(Glom::Document& document, const Glib::ustring& user, const Glib::ustring& password)
{
- Glib::ustring uri;
-
- // Get a URI for the example file:
- try
- {
- const std::string path =
- Glib::build_filename(GLOM_DOCDIR_EXAMPLES_NOTINSTALLED,
- example_filename);
- uri = Glib::filename_to_uri(path);
- }
- catch(const Glib::ConvertError& ex)
+ //TODO: Let this happen automatically on first connection?
+ Glom::ConnectionPool* connection_pool = Glom::ConnectionPool::get_instance();
+
+ connection_pool->setup_from_document(&document);
+
+ connection_pool->set_user(user);
+ connection_pool->set_password(password);
+
+ const Glom::ConnectionPool::StartupErrors started = connection_pool->startup( sigc::ptr_fun(&on_startup_progress) );
+ if(started != Glom::ConnectionPool::Backend::STARTUPERROR_NONE)
{
- std::cerr << G_STRFUNC << ": " << ex.what();
+ std::cerr << "connection_pool->startup(): result=" << started << std::endl;
+ test_selfhosting_cleanup();
return false;
}
-
- return test_create_and_selfhost_from_uri(uri, document, hosting_mode, subdirectory_path);
+ g_assert(started == Glom::ConnectionPool::Backend::STARTUPERROR_NONE);
+
+ return true;
}
-bool test_create_and_selfhost_from_uri(const Glib::ustring& example_file_uri, Glom::Document& document, Glom::Document::HostingMode hosting_mode, const std::string& subdirectory_path)
+bool test_create_and_selfhost_new_empty(Glom::Document& document, Glom::Document::HostingMode hosting_mode, const std::string& subdirectory_path)
{
if( (hosting_mode != Glom::Document::HOSTING_MODE_POSTGRES_SELF) &&
(hosting_mode != Glom::Document::HOSTING_MODE_SQLITE) )
@@ -168,26 +179,6 @@ bool test_create_and_selfhost_from_uri(const Glib::ustring& example_file_uri, Gl
return false;
}
- // Load the document:
- document.set_file_uri(example_file_uri);
- int failure_code = 0;
- const bool test = document.load(failure_code);
- //std::cout << "Document load result=" << test << std::endl;
-
- if(!test)
- {
- std::cerr << G_STRFUNC << ": Document::load() failed with failure_code=" << failure_code << std::endl;
- return false;
- }
-
- if(!document.get_is_example_file() && !document.get_is_backup_file())
- {
- std::cerr << G_STRFUNC << ": The document is not an example or a backup." << std::endl;
- return false;
- }
-
- Glom::ConnectionPool* connection_pool = Glom::ConnectionPool::get_instance();
-
//Save a copy, specifying the path to file in a directory:
//For instance, /tmp/testglom/testglom.glom");
const std::string temp_filename = "testglom";
@@ -203,9 +194,10 @@ bool test_create_and_selfhost_from_uri(const Glib::ustring& example_file_uri, Gl
delete_directory(uri);
}
- //Save the example as a real file:
- const Glib::ustring file_uri = Glib::filename_to_uri(temp_filepath);
- document.set_file_uri(file_uri);
+ //Save the example as a real file:
+ temp_file_uri = Glib::filename_to_uri(temp_filepath);
+ document.set_allow_autosave(false); //To simplify things and to not depend implicitly on autosave.
+ document.set_file_uri(temp_file_uri);
document.set_hosting_mode(hosting_mode);
document.set_is_example_file(false);
@@ -214,6 +206,7 @@ bool test_create_and_selfhost_from_uri(const Glib::ustring& example_file_uri, Gl
g_assert(saved);
//Specify the backend and backend-specific details to be used by the connectionpool.
+ Glom::ConnectionPool* connection_pool = Glom::ConnectionPool::get_instance();
connection_pool->setup_from_document(&document);
//We must specify a default username and password:
@@ -229,18 +222,101 @@ bool test_create_and_selfhost_from_uri(const Glib::ustring& example_file_uri, Gl
if(!check_directory_exists())
{
- std::cerr << "Failure: The data directory does not exist after calling initialize()." << std::endl;
+ std::cerr << "Failure: The data directory does not exist after calling initialize()." << std::endl;
+ return false;
}
//Start self-hosting:
- //TODO: Let this happen automatically on first connection?
- const Glom::ConnectionPool::StartupErrors started = connection_pool->startup( sigc::ptr_fun(&on_startup_progress) );
- if(started != Glom::ConnectionPool::Backend::STARTUPERROR_NONE)
+ return test_selfhost(document, user, password);
+}
+
+Glib::ustring test_get_temp_file_uri()
+{
+ return temp_file_uri;
+}
+
+bool test_create_and_selfhost_new_database(Glom::Document& document, Glom::Document::HostingMode hosting_mode, const Glib::ustring& database_name, const std::string& subdirectory_path)
+{
+ if(!test_create_and_selfhost_new_empty(document, hosting_mode, subdirectory_path))
{
- std::cerr << "connection_pool->startup(): result=" << started << std::endl;
- test_selfhosting_cleanup();
+ std::cerr << G_STRFUNC << ": test_create_and_selfhost_new_empty() failed." << std::endl;
+ return false;
+ }
+
+ const Glib::ustring db_name = Glom::DbUtils::get_unused_database_name(database_name);
+ if(db_name.empty())
+ {
+ std::cerr << "DbUtils::get_unused_database_name) failed." << std::endl;
+ return false;
+ }
+
+ //Create a database:
+ const bool created = Glom::DbUtils::create_database(&document, db_name,
+ "test title", sigc::ptr_fun(&on_db_creation_progress));
+ if(!created)
+ {
+ std::cerr << "DbUtils::create_database() failed." << std::endl;
+ return false;
+ }
+
+ return true;
+}
+
+
+bool test_create_and_selfhost_from_example(const std::string& example_filename, Glom::Document& document, Glom::Document::HostingMode hosting_mode, const std::string& subdirectory_path)
+{
+ Glib::ustring uri;
+
+ // Get a URI for the example file:
+ try
+ {
+ const std::string path =
+ Glib::build_filename(GLOM_DOCDIR_EXAMPLES_NOTINSTALLED,
+ example_filename);
+ uri = Glib::filename_to_uri(path);
+ }
+ catch(const Glib::ConvertError& ex)
+ {
+ std::cerr << G_STRFUNC << ": " << ex.what();
+ return false;
+ }
+
+ return test_create_and_selfhost_from_uri(uri, document, hosting_mode, subdirectory_path);
+}
+
+bool test_create_and_selfhost_from_uri(const Glib::ustring& example_file_uri, Glom::Document& document, Glom::Document::HostingMode hosting_mode, const std::string& subdirectory_path)
+{
+ if( (hosting_mode != Glom::Document::HOSTING_MODE_POSTGRES_SELF) &&
+ (hosting_mode != Glom::Document::HOSTING_MODE_SQLITE) )
+ {
+ std::cerr << G_STRFUNC << ": This test function does not support the specified hosting_mode: " << hosting_mode << std::endl;
+ return false;
+ }
+
+ // Load the document:
+ document.set_allow_autosave(false); //To simplify things and to not depend implicitly on autosave.
+ document.set_file_uri(example_file_uri);
+ int failure_code = 0;
+ const bool test = document.load(failure_code);
+ //std::cout << "Document load result=" << test << std::endl;
+
+ if(!test)
+ {
+ std::cerr << G_STRFUNC << ": Document::load() failed with failure_code=" << failure_code << std::endl;
+ return false;
+ }
+
+ if(!document.get_is_example_file() && !document.get_is_backup_file())
+ {
+ std::cerr << G_STRFUNC << ": The document is not an example or a backup." << std::endl;
+ return false;
+ }
+
+ if(!test_create_and_selfhost_new_empty(document, hosting_mode, subdirectory_path))
+ {
+ std::cerr << G_STRFUNC << ": test_create_and_selfhost_new_empty() failed." << std::endl;
+ return false;
}
- g_assert(started == Glom::ConnectionPool::Backend::STARTUPERROR_NONE);
const bool recreated = Glom::DbUtils::recreate_database_from_document(&document, sigc::ptr_fun(&on_recreate_progress) );
if(!recreated)
diff --git a/tests/test_selfhosting_utils.h b/tests/test_selfhosting_utils.h
index 355054f..0233198 100644
--- a/tests/test_selfhosting_utils.h
+++ b/tests/test_selfhosting_utils.h
@@ -27,6 +27,23 @@
/** Create a .glom file from an example, with database data, and start a PostgreSQL server if necessary.
*
+ * @param document A new empty document that will be filled with hosting details.
+ * @param hosting_mode Either HOSTING_MODE_POSTGRES_SELF or HOSTING_MODE_SQLITE
+ * @param subdirectory_path: An additional directory path to use under the temporary directory that will be used to save the file.
+ */
+bool test_create_and_selfhost_new_empty(Glom::Document& document, Glom::Document::HostingMode hosting_mode, const std::string& subdirectory_path = std::string());
+
+/** Create a .glom file from an example, with database data, and start a PostgreSQL server if necessary.
+ *
+ * @param document A new empty document that will be filled with hosting details.
+ * @param hosting_mode Either HOSTING_MODE_POSTGRES_SELF or HOSTING_MODE_SQLITE
+ * @param database_name The name of the database to created.
+ * @param subdirectory_path: An additional directory path to use under the temporary directory that will be used to save the file.
+ */
+bool test_create_and_selfhost_new_database(Glom::Document& document, Glom::Document::HostingMode hosting_mode, const Glib::ustring& database_name, const std::string& subdirectory_path = std::string());
+
+/** Create a .glom file from an example, with database data, and start a PostgreSQL server if necessary.
+ *
* @param hosting_mode Either HOSTING_MODE_POSTGRES_SELF or HOSTING_MODE_SQLITE
* @param subdirectory_path: An additional directory path to use under the temporary directory that will be used to save the file.
*/
@@ -39,10 +56,24 @@ bool test_create_and_selfhost_from_example(const std::string& example_filename,
*/
bool test_create_and_selfhost_from_uri(const Glib::ustring& file_uri, Glom::Document& document, Glom::Document::HostingMode hosting_mode, const std::string& subdirectory_path = std::string());
+/** Start self-hosting of a .glom document.
+ * @param document The document must already be saved to a file.
+ */
+bool test_selfhost(Glom::Document& document, const Glib::ustring& user, const Glib::ustring& password);
+
+
bool test_model_expected_size(const Glib::RefPtr<Gnome::Gda::DataModel>& data_model, guint columns_count, guint rows_count);
bool test_table_exists(const Glib::ustring& table_name, const Glom::Document& document);
-void test_selfhosting_cleanup();
+/** Return the URI of the temporary .glom file created by the test_create_and_selfhost_*() methods.
+ * This should only be used by some special tests.
+ */
+Glib::ustring test_get_temp_file_uri();
+
+/** Stop the self-hosting server process,
+ * and (optionally) delete the temporary .glom file and its data.
+ */
+void test_selfhosting_cleanup(bool delete_file = true);
bool test_example_musiccollection_data(const Glom::Document* document);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]