Commit 3be8c467 authored by Maurice van der Pot's avatar Maurice van der Pot Committed by Maurice van der Pot

Fix a bug in copying default day types when copying a calendar on 64-bit

2008-07-22  Maurice van der Pot  <griffon26@kfk4ever.com>

	* libplanner/mrp-calendar.c (mrp_calendar_copy):
	Fix a bug in copying default day types when copying a calendar on 64-bit
	platforms.

	* tests/calendar-test.c (main):
	Fixed a bug in the tests that only showed up on 64-bit platforms.

	* libplanner/Makefile.am:
	* libplanner/mrp-paths-gnome.c (mrp_paths_get_glade_dir),
	(mrp_paths_get_image_dir), (mrp_paths_get_plugin_dir),
	(mrp_paths_get_dtd_dir), (mrp_paths_get_stylesheet_dir),
	(mrp_paths_get_storagemodule_dir),
	(mrp_paths_get_file_modules_dir), (mrp_paths_get_ui_dir),
	(mrp_paths_get_sql_dir):
	* tests/Makefile.am:
	* tests/files/Makefile.am:
	Allow various paths to be overridden through environment variables, so the
	tests can be run before planner (and its plugins) have been installed.
	Now tests are run successfully in make check and make distcheck.


svn path=/trunk/; revision=923
parent 5ace1a32
2008-07-22 Maurice van der Pot <griffon26@kfk4ever.com>
* libplanner/mrp-calendar.c (mrp_calendar_copy):
Fix a bug in copying default day types when copying a calendar on 64-bit
platforms.
* tests/calendar-test.c (main):
Fixed a bug in the tests that only showed up on 64-bit platforms.
* libplanner/Makefile.am:
* libplanner/mrp-paths-gnome.c (mrp_paths_get_glade_dir),
(mrp_paths_get_image_dir), (mrp_paths_get_plugin_dir),
(mrp_paths_get_dtd_dir), (mrp_paths_get_stylesheet_dir),
(mrp_paths_get_storagemodule_dir),
(mrp_paths_get_file_modules_dir), (mrp_paths_get_ui_dir),
(mrp_paths_get_sql_dir):
* tests/Makefile.am:
* tests/files/Makefile.am:
Allow various paths to be overridden through environment variables, so the
tests can be run before planner (and its plugins) have been installed.
Now tests are run successfully in make check and make distcheck.
2008-07-20 Maurice van der Pot <griffon26@kfk4ever.com>
* libplanner/mrp-sql.c: Properly fixed bug #539993.
......
......@@ -5,9 +5,9 @@ INCLUDES = \
-I$(top_builddir)/libplanner \
$(LIBPLANNER_CFLAGS) $(WARN_CFLAGS) \
-DSTORAGEMODULEDIR=\""$(libdir)/planner/storage-modules"\" \
-DFILEMODULEDIR=\""$(libdir)/planner/file-modules"\" \
-DFILEMODULESDIR=\""$(libdir)/planner/file-modules"\" \
-DPLUGINDIR=\""$(libdir)/planner/plugins"\" \
-DDATADIR=\""$(datadir)"\"
-DDATADIR=\""$(datadir)/planner"\"
lib_LTLIBRARIES = libplanner-1.la
......
......@@ -440,7 +440,7 @@ mrp_calendar_copy (const gchar *name, MrpCalendar *calendar)
memcpy (ret_val->priv->default_days,
calendar->priv->default_days,
7 * sizeof (gint));
7 * sizeof (MrpDay *));
g_hash_table_foreach (calendar->priv->day_intervals,
(GHFunc) foreach_copy_day_intervals,
......
......@@ -2,6 +2,7 @@
/*
* Copyright (C) 2005 Imendio AB
* Copyright (C) 2005 Jani Tiainen
* Copyright (C) 2008 Maurice van der Pot
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -27,70 +28,108 @@
#include <config.h>
#include "mrp-paths.h"
static const gchar *plugin_dir = PLUGINDIR;
static const gchar *storagemodule_dir = STORAGEMODULEDIR;
static const gchar *file_modules_dir = FILEMODULEDIR;
static const gchar *default_plugin_dir = PLUGINDIR;
static const gchar *default_storagemodule_dir = STORAGEMODULEDIR;
static const gchar *default_file_modules_dir = FILEMODULESDIR;
static const gchar *default_data_dir = DATADIR;
static const gchar *glade_dir = DATADIR "/planner/glade";
static const gchar *image_dir = DATADIR "/planner/images";
static const gchar *dtd_dir = DATADIR "/planner/dtd";
static const gchar *stylesheet_dir = DATADIR "/planner/stylesheets";
static const gchar *ui_dir = DATADIR "/planner/ui";
static const gchar *sql_dir = DATADIR "/planner/sql";
static const gchar *locale_dir = GNOMELOCALEDIR;
static const gchar *locale_dir = GNOMELOCALEDIR;
gchar *
mrp_paths_get_glade_dir (const gchar *filename)
{
return g_build_filename (glade_dir, filename, NULL);
const gchar *env_data_dir = g_getenv ("PLANNER_DATADIR");
return g_build_filename (env_data_dir ? env_data_dir
: default_data_dir,
"glade",
filename,
NULL);
}
gchar *
mrp_paths_get_image_dir (const gchar *filename)
{
return g_build_filename (image_dir, filename, NULL);
const gchar *env_data_dir = g_getenv ("PLANNER_DATADIR");
return g_build_filename (env_data_dir ? env_data_dir
: default_data_dir,
"glade",
filename,
NULL);
}
gchar *
mrp_paths_get_plugin_dir (const gchar *filename)
{
return g_build_filename (plugin_dir, filename, NULL);
const gchar *env_plugin_dir = g_getenv ("PLANNER_PLUGINDIR");
return g_build_filename (env_plugin_dir ? env_plugin_dir
: default_plugin_dir,
filename,
NULL);
}
gchar *
mrp_paths_get_dtd_dir (const gchar *filename)
{
return g_build_filename (dtd_dir, filename, NULL);
const gchar *env_data_dir = g_getenv ("PLANNER_DATADIR");
return g_build_filename (env_data_dir ? env_data_dir
: default_data_dir,
"dtd",
filename,
NULL);
}
gchar *
mrp_paths_get_stylesheet_dir (const gchar *filename)
{
return g_build_filename (stylesheet_dir, filename, NULL);
const gchar *env_data_dir = g_getenv ("PLANNER_DATADIR");
return g_build_filename (env_data_dir ? env_data_dir
: default_data_dir,
"stylesheets",
filename,
NULL);
}
gchar *
mrp_paths_get_storagemodule_dir (const gchar *filename)
{
return g_build_filename (storagemodule_dir, filename, NULL);
const gchar *env_storagemodule_dir = g_getenv ("PLANNER_STORAGEMODULEDIR");
return g_build_filename (env_storagemodule_dir
? env_storagemodule_dir
: default_storagemodule_dir,
filename,
NULL);
}
gchar *
mrp_paths_get_file_modules_dir (const gchar *filename)
{
return g_build_filename (file_modules_dir, filename, NULL);
const gchar *env_file_modules_dir = g_getenv ("PLANNER_FILEMODULESDIR");
return g_build_filename (env_file_modules_dir
? env_file_modules_dir
: default_file_modules_dir,
filename,
NULL);
}
gchar *
mrp_paths_get_ui_dir (const gchar *filename)
{
return g_build_filename (ui_dir, filename, NULL);
const gchar *env_data_dir = g_getenv ("PLANNER_DATADIR");
return g_build_filename (env_data_dir ? env_data_dir
: default_data_dir,
"ui",
filename,
NULL);
}
gchar *
mrp_paths_get_sql_dir ()
{
return g_strdup (sql_dir);
const gchar *env_data_dir = g_getenv ("PLANNER_DATADIR");
return g_build_filename (env_data_dir ? env_data_dir
: default_data_dir,
"sql",
NULL);
}
gchar *
......
......@@ -11,13 +11,13 @@ LDADD = \
$(top_builddir)/libplanner/libplanner-1.la \
$(PLANNER_LIBS)
noinst_LTLIBRARIES = libselfcheck.la
check_LTLIBRARIES = libselfcheck.la
libselfcheck_la_SOURCES = \
self-check.c \
self-check.h
noinst_PROGRAMS = scheduler-test time-test calendar-test task-test
check_PROGRAMS = scheduler-test time-test calendar-test task-test
scheduler_test_SOURCES = scheduler-test.c
scheduler_test_LDADD = $(LDADD) libselfcheck.la
......@@ -31,6 +31,10 @@ calendar_test_LDADD = $(LDADD) libselfcheck.la
task_test_SOURCES = task-test.c
task_test_LDADD = $(LDADD) libselfcheck.la
# The loadable modules can't be found at distcheck time so disable the
# tests for distcheck.
#TESTS = scheduler-test time-test calendar-test task-test
TESTS_ENVIRONMENT = \
PLANNER_STORAGEMODULEDIR=$(top_builddir)/libplanner/.libs \
PLANNER_FILEMODULESDIR=$(top_builddir)/libplanner/.libs \
PLANNER_PLUGINDIR=$(top_builddir)/src/.libs \
PLANNER_DATADIR=$(top_srcdir)/data
TESTS = scheduler-test time-test calendar-test task-test
......@@ -55,7 +55,7 @@ main (gint argc, gchar **argv)
time_sun = mrp_time_from_string ("20021117", NULL);
time_27nov = mrp_time_from_string ("20021127", NULL);
time_28nov = mrp_time_from_string ("20021128", NULL);
/****************************************************/
/** Check one: Base calendars default week **/
/****************************************************/
......@@ -142,10 +142,10 @@ main (gint argc, gchar **argv)
/******************************************************/
mrp_calendar_set_days (base,
time_27nov, def_1_id,
-1);
(mrptime) -1);
mrp_calendar_set_days (derive,
time_28nov, mrp_day_get_nonwork (),
-1);
(mrptime) -1);
day_a = mrp_calendar_get_day (base, time_27nov, TRUE);
day_b = mrp_calendar_get_day (derive, time_27nov, TRUE);
......@@ -156,14 +156,14 @@ main (gint argc, gchar **argv)
mrp_calendar_set_days (derive,
time_27nov, mrp_day_get_nonwork (),
-1);
(mrptime) -1);
day_b = mrp_calendar_get_day (derive, time_27nov, TRUE);
CHECK_INTEGER_RESULT (mrp_day_get_id (day_b),
mrp_day_get_id (mrp_day_get_nonwork ()));
mrp_calendar_set_days (derive,
time_27nov, mrp_day_get_use_base (),
-1);
(mrptime) -1);
day_b = mrp_calendar_get_day (derive, time_27nov, TRUE);
CHECK_INTEGER_RESULT (mrp_day_get_id (day_a),
mrp_day_get_id (day_b));
......
EXTRA_DIST = test-1.planner
EXTRA_DIST = test-1.planner test-2.planner
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment