static void test_teardown (void) { ck_g_object_final_unref (registry); ck_g_object_final_unref (song); ck_g_object_final_unref (app); }
static void test_teardown (void) { g_object_unref (setup); ck_g_object_final_unref (song); g_object_unref (settings); ck_g_object_final_unref (app); }
static void test_teardown (void) { g_object_unref (pattern); pattern = NULL; machine = NULL; ck_g_object_final_unref (song); ck_g_object_final_unref (app); }
static void test_translate_str_length (BT_TEST_ARGS) { BT_TEST_START; GstBtToneConversion *n2f; gdouble frq; n2f = gstbt_tone_conversion_new (GSTBT_TONE_CONVERSION_EQUAL_TEMPERAMENT); fail_unless (n2f != NULL, NULL); g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) & ~G_LOG_LEVEL_CRITICAL); frq = gstbt_tone_conversion_translate_from_string (n2f, "x"); fail_unless (frq == 0.0, NULL); frq = gstbt_tone_conversion_translate_from_string (n2f, "x-"); fail_unless (frq == 0.0, NULL); frq = gstbt_tone_conversion_translate_from_string (n2f, "x-000"); fail_unless (frq == 0.0, NULL); g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) | G_LOG_LEVEL_CRITICAL); // free object ck_g_object_final_unref (n2f); BT_TEST_END; }
static void test_bt_cmd_application_info_for_incomplete_file (BT_TEST_ARGS) { BT_TEST_START; GST_INFO ("-- arrange --"); BtCmdApplication *app = bt_cmd_application_new (TRUE); gchar *tmp_file_name = g_build_filename (g_get_tmp_dir (), "broken2.xml.txt", NULL); GST_INFO ("-- act --"); gboolean ret = bt_cmd_application_info (app, check_get_test_song_path ("broken2.xml"), tmp_file_name); GST_INFO ("-- assert --"); fail_unless (ret == TRUE, NULL); fail_unless (check_file_contains_str (NULL, tmp_file_name, "song.song_info.name: \"broken 2\""), NULL); fail_unless (check_file_contains_str (NULL, tmp_file_name, "song.setup.number_of_missing_machines: 1"), NULL); fail_unless (check_file_contains_str (NULL, tmp_file_name, "song.wavetable.number_of_missing_waves: 2"), NULL); GST_INFO ("-- cleanup --"); g_unlink (tmp_file_name); g_free (tmp_file_name); ck_g_object_final_unref (app); BT_TEST_END; }
static void test_teardown (void) { ck_g_object_final_unref (registry); if (seq) { snd_seq_close (seq); } }
static void test_teardown (void) { gtk_widget_destroy (GTK_WIDGET (main_window)); flush_main_loop (); ck_g_object_final_unref (app); bt_edit_teardown (); }
// load file into non empty song static void test_bt_song_io_native_load_twice (BT_TEST_ARGS) { BT_TEST_START; GST_INFO ("-- arrange --"); BtSongIO *song_io = bt_song_io_from_file (check_get_test_song_path ("test-simple1.xml"), NULL); bt_song_io_load (song_io, song, NULL); ck_g_object_final_unref (song_io); song_io = bt_song_io_from_file (check_get_test_song_path ("test-simple2.xml"), NULL); /* act & assert */ fail_unless (bt_song_io_load (song_io, song, NULL), NULL); GST_INFO ("-- cleanup --"); ck_g_object_final_unref (song_io); BT_TEST_END; }
static void test_bt_cmd_application_create (BT_TEST_ARGS) { BT_TEST_START; GST_INFO ("-- arrange --"); GST_INFO ("-- act --"); BtCmdApplication *app = bt_cmd_application_new (TRUE); GST_INFO ("-- assert --"); fail_unless (app != NULL, NULL); ck_assert_int_eq (G_OBJECT_REF_COUNT (app), 1); GST_INFO ("-- cleanup --"); ck_g_object_final_unref (app); BT_TEST_END; }
// load files with errors static void test_bt_song_io_native_bad_songs (BT_TEST_ARGS) { BT_TEST_START; GST_INFO ("-- arrange --"); BtSongIO *song_io = bt_song_io_from_file (check_get_test_song_path (bad_songs[_i]), NULL); GST_INFO ("-- act & assert --"); GError *err = NULL; fail_if (bt_song_io_load (song_io, song, &err), NULL); fail_if (err == NULL, NULL); GST_INFO ("-- cleanup --"); g_error_free (err); ck_g_object_final_unref (song_io); BT_TEST_END; }
static void test_bt_cmd_application_play (BT_TEST_ARGS) { BT_TEST_START; GST_INFO ("-- arrange --"); BtCmdApplication *app = bt_cmd_application_new (TRUE); GST_INFO ("-- act --"); gboolean ret = bt_cmd_application_play (app, check_get_test_song_path ("test-simple1.xml")); GST_INFO ("-- assert --"); fail_unless (ret == TRUE, NULL); GST_INFO ("-- cleanup --"); ck_g_object_final_unref (app); BT_TEST_END; }
static void test_bt_cmd_application_play_incomplete_file (BT_TEST_ARGS) { BT_TEST_START; GST_INFO ("-- arrange --"); BtCmdApplication *app = bt_cmd_application_new (TRUE); GST_INFO ("-- act --"); gboolean ret = bt_cmd_application_play (app, check_get_test_song_path ("broken2.xml")); GST_INFO ("-- assert --"); // we should still attempt to play it fail_unless (ret == TRUE, NULL); GST_INFO ("-- cleanup --"); ck_g_object_final_unref (app); BT_TEST_END; }
static void test_bt_cmd_application_info (BT_TEST_ARGS) { BT_TEST_START; GST_INFO ("-- arrange --"); BtCmdApplication *app = bt_cmd_application_new (TRUE); gchar *tmp_file_name = g_build_filename (g_get_tmp_dir (), "test-simple1.xml.txt", NULL); GST_INFO ("-- act --"); gboolean ret = bt_cmd_application_info (app, check_get_test_song_path ("test-simple1.xml"), tmp_file_name); GST_INFO ("-- assert --"); fail_unless (ret == TRUE, NULL); fail_unless (check_file_contains_str (NULL, tmp_file_name, "song.song_info.name: \"test simple 1\""), NULL); GST_INFO ("-- cleanup --"); g_unlink (tmp_file_name); g_free (tmp_file_name); ck_g_object_final_unref (app); BT_TEST_END; }