/* test-case.c generated by valac 0.26.0.36-540e, the Vala compiler
 * generated from test-case.vala, do not modify */

/* test-case.vala
 *
 * Copyright © 2013 Intel Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library 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
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 *      Simon McVittie <simon.mcvittie@collabora.co.uk>
 */

#include <glib.h>
#include <glib-object.h>
#include <folks-test.h>
#include <stdlib.h>
#include <string.h>


#define KF_TEST_TYPE_TEST_CASE (kf_test_test_case_get_type ())
#define KF_TEST_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KF_TEST_TYPE_TEST_CASE, KfTestTestCase))
#define KF_TEST_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KF_TEST_TYPE_TEST_CASE, KfTestTestCaseClass))
#define KF_TEST_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KF_TEST_TYPE_TEST_CASE))
#define KF_TEST_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KF_TEST_TYPE_TEST_CASE))
#define KF_TEST_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KF_TEST_TYPE_TEST_CASE, KfTestTestCaseClass))

typedef struct _KfTestTestCase KfTestTestCase;
typedef struct _KfTestTestCaseClass KfTestTestCaseClass;
typedef struct _KfTestTestCasePrivate KfTestTestCasePrivate;

#define KF_TEST_TYPE_BACKEND (kf_test_backend_get_type ())
#define KF_TEST_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KF_TEST_TYPE_BACKEND, KfTestBackend))
#define KF_TEST_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KF_TEST_TYPE_BACKEND, KfTestBackendClass))
#define KF_TEST_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KF_TEST_TYPE_BACKEND))
#define KF_TEST_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KF_TEST_TYPE_BACKEND))
#define KF_TEST_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KF_TEST_TYPE_BACKEND, KfTestBackendClass))

typedef struct _KfTestBackend KfTestBackend;
typedef struct _KfTestBackendClass KfTestBackendClass;
#define _kf_test_backend_unref0(var) ((var == NULL) ? NULL : (var = (kf_test_backend_unref (var), NULL)))
#define _g_main_context_unref0(var) ((var == NULL) ? NULL : (var = (g_main_context_unref (var), NULL)))

struct _KfTestTestCase {
	FolksTestCase parent_instance;
	KfTestTestCasePrivate * priv;
	KfTestBackend* kf_backend;
};

struct _KfTestTestCaseClass {
	FolksTestCaseClass parent_class;
};


static gpointer kf_test_test_case_parent_class = NULL;

GType kf_test_test_case_get_type (void) G_GNUC_CONST;
gpointer kf_test_backend_ref (gpointer instance);
void kf_test_backend_unref (gpointer instance);
GParamSpec* kf_test_param_spec_backend (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void kf_test_value_set_backend (GValue* value, gpointer v_object);
void kf_test_value_take_backend (GValue* value, gpointer v_object);
gpointer kf_test_value_get_backend (const GValue* value);
GType kf_test_backend_get_type (void) G_GNUC_CONST;
enum  {
	KF_TEST_TEST_CASE_DUMMY_PROPERTY
};
KfTestTestCase* kf_test_test_case_new (const gchar* name);
KfTestTestCase* kf_test_test_case_construct (GType object_type, const gchar* name);
KfTestBackend* kf_test_backend_new (void);
KfTestBackend* kf_test_backend_construct (GType object_type);
static void kf_test_test_case_real_tear_down (FolksTestCase* base);
static void kf_test_test_case_finalize (GObject* obj);


KfTestTestCase* kf_test_test_case_construct (GType object_type, const gchar* name) {
	KfTestTestCase * self = NULL;
	const gchar* _tmp0_ = NULL;
	KfTestBackend* _tmp1_ = NULL;
#line 41 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	g_return_val_if_fail (name != NULL, NULL);
#line 43 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	_tmp0_ = name;
#line 43 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	self = (KfTestTestCase*) folks_test_case_construct (object_type, _tmp0_);
#line 45 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	_tmp1_ = kf_test_backend_new ();
#line 45 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	_kf_test_backend_unref0 (self->kf_backend);
#line 45 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	self->kf_backend = _tmp1_;
#line 47 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	g_setenv ("FOLKS_BACKENDS_ALLOWED", "key-file", TRUE);
#line 48 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	g_setenv ("FOLKS_PRIMARY_STORE", "key-file", TRUE);
#line 41 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	return self;
#line 111 "test-case.c"
}


KfTestTestCase* kf_test_test_case_new (const gchar* name) {
#line 41 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	return kf_test_test_case_construct (KF_TEST_TYPE_TEST_CASE, name);
#line 118 "test-case.c"
}


static gpointer _g_main_context_ref0 (gpointer self) {
#line 60 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	return self ? g_main_context_ref (self) : NULL;
#line 125 "test-case.c"
}


static void kf_test_test_case_real_tear_down (FolksTestCase* base) {
	KfTestTestCase * self;
	GMainContext* context = NULL;
	GMainContext* _tmp0_ = NULL;
	GMainContext* _tmp1_ = NULL;
#line 51 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	self = (KfTestTestCase*) base;
#line 60 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	_tmp0_ = g_main_context_default ();
#line 60 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	_tmp1_ = _g_main_context_ref0 (_tmp0_);
#line 60 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	context = _tmp1_;
#line 61 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	while (TRUE) {
#line 144 "test-case.c"
		GMainContext* _tmp2_ = NULL;
		gboolean _tmp3_ = FALSE;
#line 61 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
		_tmp2_ = context;
#line 61 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
		_tmp3_ = g_main_context_iteration (_tmp2_, FALSE);
#line 61 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
		if (!_tmp3_) {
#line 61 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
			break;
#line 155 "test-case.c"
		}
	}
#line 63 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	FOLKS_TEST_CASE_CLASS (kf_test_test_case_parent_class)->tear_down (G_TYPE_CHECK_INSTANCE_CAST (self, FOLKS_TYPE_TEST_CASE, FolksTestCase));
#line 51 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	_g_main_context_unref0 (context);
#line 162 "test-case.c"
}


static void kf_test_test_case_class_init (KfTestTestCaseClass * klass) {
#line 27 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	kf_test_test_case_parent_class = g_type_class_peek_parent (klass);
#line 27 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	((FolksTestCaseClass *) klass)->tear_down = kf_test_test_case_real_tear_down;
#line 27 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	G_OBJECT_CLASS (klass)->finalize = kf_test_test_case_finalize;
#line 173 "test-case.c"
}


static void kf_test_test_case_instance_init (KfTestTestCase * self) {
}


static void kf_test_test_case_finalize (GObject* obj) {
	KfTestTestCase * self;
#line 27 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KF_TEST_TYPE_TEST_CASE, KfTestTestCase);
#line 39 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	_kf_test_backend_unref0 (self->kf_backend);
#line 27 "/opt/gnome3/source/folks/tests/lib/key-file/test-case.vala"
	G_OBJECT_CLASS (kf_test_test_case_parent_class)->finalize (obj);
#line 189 "test-case.c"
}


/**
 * A test case for the key-file backend, which is configured as the
 * primary store and as the only backend allowed.
 */
GType kf_test_test_case_get_type (void) {
	static volatile gsize kf_test_test_case_type_id__volatile = 0;
	if (g_once_init_enter (&kf_test_test_case_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (KfTestTestCaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) kf_test_test_case_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (KfTestTestCase), 0, (GInstanceInitFunc) kf_test_test_case_instance_init, NULL };
		GType kf_test_test_case_type_id;
		kf_test_test_case_type_id = g_type_register_static (FOLKS_TYPE_TEST_CASE, "KfTestTestCase", &g_define_type_info, 0);
		g_once_init_leave (&kf_test_test_case_type_id__volatile, kf_test_test_case_type_id);
	}
	return kf_test_test_case_type_id__volatile;
}



