Updated Finnish translation
[rhythmbox.git] / tests / test-rhythmdb.c
blob4e07773c7ed2bf2c712cda322c4bb6d8ab7de9bb
1 #include <check.h>
2 #include <gtk/gtk.h>
3 #include <string.h>
5 #include "rb-debug.h"
6 #include "rb-file-helpers.h"
7 #include "rb-util.h"
9 #include "rhythmdb.h"
10 #include "rhythmdb-tree.h"
11 #include "rhythmdb-query-model.h"
13 #ifndef fail_if
14 #define fail_if(expr, ...) fail_unless(!(expr), "Failure '"#expr"' occured")
15 #endif
18 /* test utils */
19 gboolean waiting, signaled;
20 char *sig_name;
21 gulong sig_handler;
22 GObject *sig_object;
24 static void
25 mark_signal (void)
27 g_signal_handler_disconnect (sig_object, sig_handler);
28 sig_object = NULL;
29 sig_handler = 0;
31 if (signaled) {
32 rb_debug ("got signal '%s' multiple times", sig_name);
33 } else {
34 rb_debug ("got signal '%s'", sig_name);
35 signaled = TRUE;
36 if (waiting)
37 gtk_main_quit ();
41 static void
42 set_waiting_signal (GObject *o, const char *name)
44 signaled = FALSE;
45 waiting = FALSE;
46 sig_name = g_strdup (name);
47 sig_object = o;
48 sig_handler = g_signal_connect (o, sig_name, G_CALLBACK (mark_signal), NULL);
51 static void wait_for_signal (void)
53 if (!signaled) {
54 rb_debug ("waiting for signal '%s'", sig_name);
55 waiting = TRUE;
56 gtk_main ();
57 } else {
58 rb_debug ("no need to wait for signal '%s', already received", sig_name);
61 g_free (sig_name);
62 sig_name = NULL;
66 /* common setup and teardown */
67 RhythmDB *db = NULL;
68 gboolean waiting_db, finalised_db;
70 static void
71 test_rhythmdb_setup (void)
73 RhythmDBEntryType entry_type;
74 db = rhythmdb_tree_new ("test");
75 fail_unless (db != NULL, "failed to initialise DB");
76 rhythmdb_start_action_thread (db);
78 /* allow SONGs to be synced to for the tests */
79 entry_type = RHYTHMDB_ENTRY_TYPE_SONG;
80 entry_type->can_sync_metadata = (RhythmDBEntryCanSyncFunc)rb_true_function;
81 entry_type->sync_metadata = (RhythmDBEntrySyncFunc)rb_null_function;
84 static void
85 test_rhythmdb_shutdown (void)
87 fail_unless (db != NULL, "failed to shutdown DB");
88 rhythmdb_shutdown (db);
90 /* release the reference, and wait until after finalisation */
91 g_object_weak_ref (G_OBJECT (db), (GWeakNotify)gtk_main_quit, NULL);
92 g_idle_add ((GSourceFunc)g_object_unref, db);
93 gtk_main ();
94 db = NULL;
97 static void
98 set_true (RhythmDBEntry *entry, gboolean *b)
100 *b = TRUE;
103 /* tests */
104 START_TEST (test_rhythmdb_indexing)
106 RhythmDBEntry *entry = NULL;
107 GValue val = {0,};
108 gboolean b;
110 entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_SONG, "file:///whee.ogg");
111 fail_unless (entry != NULL, "failed to create entry");
113 g_value_init (&val, G_TYPE_STRING);
114 g_value_set_static_string (&val, "Rock");
115 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_GENRE, &val);
116 g_value_unset (&val);
118 g_value_init (&val, G_TYPE_STRING);
119 g_value_set_static_string (&val, "Nine Inch Nails");
120 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_ARTIST, &val);
121 g_value_unset (&val);
123 g_value_init (&val, G_TYPE_STRING);
124 g_value_set_static_string (&val, "Pretty Hate Machine");
125 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_ALBUM, &val);
126 g_value_unset (&val);
128 g_value_init (&val, G_TYPE_STRING);
129 g_value_set_static_string (&val, "Sin");
130 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_TITLE, &val);
131 g_value_unset (&val);
133 rhythmdb_commit (db);
135 /* check the data is recorded correctly */
136 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), "file:///whee.ogg") == 0,
137 "LOCATION set incorrectly");
138 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE), "Rock") == 0,
139 "GENRE set incorrectly");
140 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST), "Nine Inch Nails") == 0,
141 "ARTIST set incorrectly");
142 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM), "Pretty Hate Machine") == 0,
143 "ALBUM set incorrectly");
144 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE), "Sin") == 0,
145 "TITLE set incorrectly");
147 /* check changing album */
148 g_value_init (&val, G_TYPE_STRING);
149 g_value_set_static_string (&val, "Broken");
150 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_ALBUM, &val);
151 g_value_unset (&val);
152 rhythmdb_commit (db);
154 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), "file:///whee.ogg") == 0,
155 "LOCATION set incorrectly");
156 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE), "Rock") == 0,
157 "GENRE set incorrectly");
158 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST), "Nine Inch Nails") == 0,
159 "ARTIST set incorrectly");
160 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM), "Broken") == 0,
161 "ALBUM set incorrectly");
162 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE), "Sin") == 0,
163 "TITLE set incorrectly");
165 /* check changing artist */
166 g_value_init (&val, G_TYPE_STRING);
167 g_value_set_static_string (&val, "Evanescence");
168 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_ARTIST, &val);
169 g_value_unset (&val);
170 rhythmdb_commit (db);
172 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), "file:///whee.ogg") == 0,
173 "LOCATION set incorrectly");
174 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE), "Rock") == 0,
175 "GENRE set incorrectly");
176 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST), "Evanescence") == 0,
177 "ARTIST set incorrectly");
178 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM), "Broken") == 0,
179 "ALBUM set incorrectly");
180 fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE), "Sin") == 0,
181 "TITLE set incorrectly");
183 /* check removal */
184 rhythmdb_entry_delete (db, entry);
185 entry = NULL;
187 b = FALSE;
188 rhythmdb_entry_foreach (db, (GFunc)set_true, &b);
189 fail_unless (b == FALSE, "entry not deleted");
191 END_TEST
193 START_TEST (test_rhythmdb_multiple)
195 RhythmDBEntry *entry1, *entry2, *entry3;
197 /* add multiple entries */
198 entry1 = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_SONG, "file:///foo.mp3");
199 rhythmdb_commit (db);
200 fail_unless (entry1 != NULL, "failed to create entry");
201 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == entry1, "entry missing");
203 entry2 = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_SONG, "file:///bar.mp3");
204 rhythmdb_commit (db);
205 fail_unless (entry2 != NULL, "failed to create entry");
206 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == entry2, "entry missing");
208 entry3 = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_SONG, "file:///baz.mp3");
209 rhythmdb_commit (db);
210 fail_unless (entry3 != NULL, "failed to create entry");
211 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == entry3, "entry missing");
213 /* check they're still there */
214 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == entry1, "entry missing");
215 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == entry2, "entry missing");
216 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == entry3, "entry missing");
218 /* remove the middle one and check again */
219 rhythmdb_entry_delete (db, entry2);
220 rhythmdb_commit (db);
222 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == entry1, "entry missing");
223 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == NULL, "entry not deleted");
224 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == entry3, "entry missing");
226 /* and the others */
227 rhythmdb_entry_delete (db, entry1);
228 rhythmdb_entry_delete (db, entry3);
229 rhythmdb_commit (db);
231 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == NULL, "entry not deleted");
232 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == NULL, "entry not deleted");
233 fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == NULL, "entry not deleted");
235 END_TEST
237 START_TEST (test_rhythmdb_mirroring)
239 GValue val = {0,};
240 RhythmDBEntry *entry;
241 const char *str;
243 entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_SONG, "file:///foo.mp3");
244 fail_unless (entry != NULL, "failed to create entry");
246 /* check the last-played date is mirrored */
247 g_value_init (&val, G_TYPE_ULONG);
248 g_value_set_ulong (&val, 1354285);
249 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_LAST_PLAYED, &val);
250 g_value_unset (&val);
251 rhythmdb_commit (db);
253 str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LAST_PLAYED_STR);
254 fail_unless (str && (strlen (str) > 0), "date not converted to string");
256 /* check folded and sort-key varients */
257 g_value_init (&val, G_TYPE_STRING);
258 g_value_set_static_string (&val, "FOO");
259 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_TITLE, &val);
260 g_value_unset (&val);
261 rhythmdb_commit (db);
263 str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE_SORT_KEY);
264 fail_unless (str && (strlen (str) > 0), "sort-key not generated");
265 str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE_FOLDED);
266 fail_unless (str && (strcmp (str, "foo") == 0), "folded variant not generated");
268 g_value_init (&val, G_TYPE_STRING);
269 g_value_set_static_string (&val, "BAR");
270 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_TITLE, &val);
271 g_value_unset (&val);
272 rhythmdb_commit (db);
274 str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE_SORT_KEY);
275 fail_unless (str && (strlen (str) > 0), "sort-key not generated");
276 str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE_FOLDED);
277 fail_unless (str && (strcmp (str, "bar") == 0), "folded variant not generated");
281 END_TEST
283 START_TEST (test_rhythmdb_db_queries)
285 RhythmDBEntry *entry = NULL;
286 RhythmDBQuery *query;
287 GValue val = {0,};
289 entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_SONG, "file:///whee.ogg");
290 fail_unless (entry != NULL, "failed to create entry");
292 g_value_init (&val, G_TYPE_STRING);
293 g_value_set_static_string (&val, "Rock");
294 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_GENRE, &val);
295 g_value_unset (&val);
297 g_value_init (&val, G_TYPE_STRING);
298 g_value_set_static_string (&val, "Nine Inch Nails");
299 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_ARTIST, &val);
300 g_value_unset (&val);
302 g_value_init (&val, G_TYPE_STRING);
303 g_value_set_static_string (&val, "Pretty Hate Machine");
304 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_ALBUM, &val);
305 g_value_unset (&val);
307 g_value_init (&val, G_TYPE_STRING);
308 g_value_set_static_string (&val, "Sin");
309 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_TITLE, &val);
310 g_value_unset (&val);
312 rhythmdb_commit (db);
314 /* basic queries and conjunctions */
315 query = rhythmdb_query_parse (db,
316 RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_TYPE, RHYTHMDB_ENTRY_TYPE_SONG,
317 RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_TITLE, "Sin",
318 RHYTHMDB_QUERY_END);
319 fail_unless (rhythmdb_evaluate_query (db, query, entry), "query evaluated incorrectly");
320 rhythmdb_query_free (query);
322 query = rhythmdb_query_parse (db,
323 RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_ARTIST, "Nine Inch",
324 RHYTHMDB_QUERY_END);
325 fail_unless (rhythmdb_evaluate_query (db, query, entry), "query evaluated incorrectly");
326 rhythmdb_query_free (query);
328 query = rhythmdb_query_parse (db,
329 RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_ALBUM, "Load",
330 RHYTHMDB_QUERY_END);
331 fail_if (rhythmdb_evaluate_query (db, query, entry), "query evaluated incorrectly");
332 rhythmdb_query_free (query);
334 query = rhythmdb_query_parse (db,
335 RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_SEARCH_MATCH, "Pretty Nine",
336 RHYTHMDB_QUERY_END);
337 rhythmdb_query_preprocess (db, query);
338 fail_unless (rhythmdb_evaluate_query (db, query, entry), "query evaluated incorrectly");
339 rhythmdb_query_free (query);
341 /* disjunctions */
342 query = rhythmdb_query_parse (db,
343 RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_TITLE, "Sin",
344 RHYTHMDB_QUERY_DISJUNCTION,
345 RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_TITLE, "Son",
346 RHYTHMDB_QUERY_END);
347 fail_unless (rhythmdb_evaluate_query (db, query, entry), "query evaluated incorrectly");
348 rhythmdb_query_free (query);
350 query = rhythmdb_query_parse (db,
351 RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_TITLE, "Sun",
352 RHYTHMDB_QUERY_DISJUNCTION,
353 RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_TITLE, "Sin",
354 RHYTHMDB_QUERY_END);
355 fail_unless (rhythmdb_evaluate_query (db, query, entry), "query evaluated incorrectly");
356 rhythmdb_query_free (query);
358 query = rhythmdb_query_parse (db,
359 RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_TITLE, "Sun",
360 RHYTHMDB_QUERY_DISJUNCTION,
361 RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_TITLE, "Son",
362 RHYTHMDB_QUERY_END);
363 fail_if (rhythmdb_evaluate_query (db, query, entry), "query evaluated incorrectly");
364 rhythmdb_query_free (query);
366 /* TODO: subqueries */
368 rhythmdb_entry_delete (db, entry);
370 END_TEST
372 START_TEST (test_rhythmdb_deserialisation1)
374 RhythmDBQueryModel *model;
376 /* empty db */
377 g_object_set (G_OBJECT (db), "name", "deserialization-test1.xml", NULL);
378 set_waiting_signal (G_OBJECT (db), "load-complete");
379 rhythmdb_load (db);
380 wait_for_signal ();
382 model = rhythmdb_query_model_new_empty (db);
383 g_object_set (G_OBJECT (model), "show-hidden", TRUE, NULL);
384 set_waiting_signal (G_OBJECT (model), "complete");
385 rhythmdb_do_full_query (db, RHYTHMDB_QUERY_RESULTS (model),
386 NULL,
387 RHYTHMDB_QUERY_PROP_EQUALS,
388 RHYTHMDB_PROP_TYPE, RHYTHMDB_ENTRY_TYPE_SONG,
389 RHYTHMDB_QUERY_END);
390 wait_for_signal ();
391 fail_unless (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 0, "deserialisation incorrect");
392 g_object_unref (model);
394 END_TEST
396 START_TEST (test_rhythmdb_deserialisation2)
398 RhythmDBQueryModel *model;
400 /* single entry db */
401 g_object_set (G_OBJECT (db), "name", "deserialization-test2.xml", NULL);
402 set_waiting_signal (G_OBJECT (db), "load-complete");
403 rhythmdb_load (db);
404 wait_for_signal ();
406 model = rhythmdb_query_model_new_empty (db);
407 g_object_set (G_OBJECT (model), "show-hidden", TRUE, NULL);
408 set_waiting_signal (G_OBJECT (model), "complete");
409 rhythmdb_do_full_query (db, RHYTHMDB_QUERY_RESULTS (model),
410 NULL,
411 RHYTHMDB_QUERY_PROP_EQUALS,
412 RHYTHMDB_PROP_TYPE, RHYTHMDB_ENTRY_TYPE_SONG,
413 RHYTHMDB_QUERY_END);
414 wait_for_signal ();
415 /* FIXME: this fails for some reason
416 fail_unless (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 1, "deserialisation incorrect");*/
417 g_object_unref (model);
419 /* TODO: check values */
421 END_TEST
423 START_TEST (test_rhythmdb_deserialisation3)
425 RhythmDBQueryModel *model;
427 /* two entries of different types db */
428 g_object_set (G_OBJECT (db), "name", "deserialization-test3.xml", NULL);
429 set_waiting_signal (G_OBJECT (db), "load-complete");
430 rhythmdb_load (db);
431 wait_for_signal ();
433 model = rhythmdb_query_model_new_empty (db);
434 g_object_set (G_OBJECT (model), "show-hidden", TRUE, NULL);
435 set_waiting_signal (G_OBJECT (model), "complete");
436 rhythmdb_do_full_query (db, RHYTHMDB_QUERY_RESULTS (model),
437 NULL,
438 RHYTHMDB_QUERY_PROP_EQUALS,
439 RHYTHMDB_PROP_TYPE, RHYTHMDB_ENTRY_TYPE_SONG,
440 RHYTHMDB_QUERY_END);
441 wait_for_signal ();
442 /* FIXME: this fails for some reason
443 fail_unless (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 1, "deserialisation incorrect");*/
444 g_object_unref (model);
446 /* TODO: check values */
448 END_TEST
450 /* this tests that chained query models, where the base shows hidden entries
451 * forwards visibility changes correctly. This is basically what static playlists do */
452 START_TEST (test_hidden_chain_filter)
454 RhythmDBQueryModel *base_model;
455 RhythmDBQueryModel *filter_model;
456 RhythmDBQuery *query;
457 RhythmDBEntry *entry;
458 GtkTreeIter iter;
459 GValue val = {0,};
461 /* setup */
462 base_model = rhythmdb_query_model_new_empty (db);
463 g_object_set (base_model, "show-hidden", TRUE, NULL);
465 filter_model = rhythmdb_query_model_new_empty (db);
466 g_object_set (filter_model, "base-model", base_model, NULL);
467 query = g_ptr_array_new ();
468 g_object_set (filter_model, "query", query, NULL);
469 rhythmdb_query_free (query);
471 entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_SONG, "file:///whee.ogg");
472 rhythmdb_commit (db);
474 g_value_init (&val, G_TYPE_BOOLEAN);
477 /* add entry to base, should be in both */
478 rhythmdb_query_model_add_entry (base_model, entry, -1);
479 fail_unless (rhythmdb_query_model_entry_to_iter (base_model, entry, &iter));
480 fail_unless (rhythmdb_query_model_entry_to_iter (filter_model, entry, &iter));
482 /* hide entry, should be in base and not filtered */
483 g_value_set_boolean (&val, TRUE);
484 set_waiting_signal (G_OBJECT (db), "entry-changed");
485 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_HIDDEN, &val);
486 rhythmdb_commit (db);
487 wait_for_signal ();
489 fail_unless (rhythmdb_query_model_entry_to_iter (base_model, entry, &iter));
490 fail_if (rhythmdb_query_model_entry_to_iter (filter_model, entry, &iter));
492 /* show entry again, should be in both */
493 g_value_set_boolean (&val, FALSE);
494 set_waiting_signal (G_OBJECT (db), "entry-changed");
495 rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_HIDDEN, &val);
496 rhythmdb_commit (db);
497 wait_for_signal ();
499 fail_unless (rhythmdb_query_model_entry_to_iter (base_model, entry, &iter));
500 fail_unless (rhythmdb_query_model_entry_to_iter (filter_model, entry, &iter));
502 /* tidy up */
503 rhythmdb_entry_delete (db, entry);
504 g_object_unref (base_model);
505 g_object_unref (filter_model);
506 g_value_unset (&val);
508 END_TEST
510 static Suite *
511 rhythmdb_suite (void)
513 Suite *s = suite_create ("rhythmdb");
514 TCase *tc_chain = tcase_create ("rhythmdb-core");
515 TCase *tc_bugs = tcase_create ("rhythmdb-bugs");
517 suite_add_tcase (s, tc_chain);
518 tcase_add_checked_fixture (tc_chain, test_rhythmdb_setup, test_rhythmdb_shutdown);
519 suite_add_tcase (s, tc_bugs);
520 tcase_add_checked_fixture (tc_bugs, test_rhythmdb_setup, test_rhythmdb_shutdown);
522 /* test core functionality */
523 /*tcase_add_test (tc_chain, test_refstring);*/
524 tcase_add_test (tc_chain, test_rhythmdb_indexing);
525 tcase_add_test (tc_chain, test_rhythmdb_multiple);
526 tcase_add_test (tc_chain, test_rhythmdb_mirroring);
527 /*tcase_add_test (tc_chain, test_rhythmdb_signals);*/
528 /*tcase_add_test (tc_chain, test_rhythmdb_query);*/
529 tcase_add_test (tc_chain, test_rhythmdb_db_queries);
530 /*tcase_add_test (tc_chain, test_rhythmdb_query_model);*/
531 /*tcase_add_test (tc_chain, test_rhythmdb_chained_query_model);*/
532 /*tcase_add_test (tc_chain, test_rhythmdb_property_model);*/
533 tcase_add_test (tc_chain, test_rhythmdb_deserialisation1);
534 tcase_add_test (tc_chain, test_rhythmdb_deserialisation2);
535 tcase_add_test (tc_chain, test_rhythmdb_deserialisation3);
536 /*tcase_add_test (tc_chain, test_rhythmdb_serialisation);*/
538 /* tests for breakable bug fixes */
539 tcase_add_test (tc_bugs, test_hidden_chain_filter);
541 return s;
545 main (int argc, char **argv)
547 int ret;
548 SRunner *sr;
549 Suite *s;
551 /* init stuff */
552 rb_profile_start ("rhythmbox test suite");
554 g_thread_init (NULL);
555 rb_threads_init ();
556 gtk_set_locale ();
557 gtk_init (&argc, &argv);
558 gnome_vfs_init ();
559 rb_debug_init (TRUE);
560 rb_refstring_system_init ();
561 rb_file_helpers_init ();
564 GDK_THREADS_ENTER ();
566 /* setup tests */
567 s = rhythmdb_suite ();
568 sr = srunner_create (s);
569 srunner_run_all (sr, CK_NORMAL);
570 ret = srunner_ntests_failed (sr);
571 srunner_free (sr);
574 rb_file_helpers_shutdown ();
575 rb_refstring_system_shutdown ();
576 gnome_vfs_shutdown ();
578 rb_profile_end ("rhythmbox test suite");
579 return ret;