| 1 |
|
| 2 |
nn |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#include <glib.h> |
| 21 |
#include <glib-object.h> |
| 22 |
|
| 23 |
#include <CUnit/CUnit.h> |
| 24 |
#include <CUnit/Automated.h> |
| 25 |
#include <CUnit/Basic.h> |
| 26 |
|
| 27 |
#include <ags/libags.h> |
| 28 |
#include <ags/libags-audio.h> |
| 29 |
|
| 30 |
#include <math.h> |
| 31 |
|
| 32 |
int ags_fx_eq10_channel_test_init_suite(); |
| 33 |
int ags_fx_eq10_channel_test_clean_suite(); |
| 34 |
|
| 35 |
void ags_fx_eq10_channel_stub_finalize(GObject *gobject); |
| 36 |
|
| 37 |
void ags_fx_eq10_channel_test_new(); |
| 38 |
void ags_fx_eq10_channel_test_dispose(); |
| 39 |
void ags_fx_eq10_channel_test_finalize(); |
| 40 |
|
| 41 |
gboolean finalized; |
| 42 |
|
| 43 |
void |
| 44 |
ags_fx_eq10_channel_stub_finalize(GObject *gobject) |
| 45 |
{ |
| 46 |
finalized = TRUE; |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
int |
| 54 |
ags_fx_eq10_channel_test_init_suite() |
| 55 |
{ |
| 56 |
return(0); |
| 57 |
} |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
int |
| 64 |
ags_fx_eq10_channel_test_clean_suite() |
| 65 |
{ |
| 66 |
return(0); |
| 67 |
} |
| 68 |
|
| 69 |
void |
| 70 |
ags_fx_eq10_channel_test_new() |
| 71 |
{ |
| 72 |
AgsChannel *channel; |
| 73 |
AgsFxEq10Channel *fx_eq10_channel; |
| 74 |
|
| 75 |
channel = g_object_new(AGS_TYPE_CHANNEL, |
| 76 |
NULL); |
| 77 |
|
| 78 |
fx_eq10_channel = ags_fx_eq10_channel_new(channel); |
| 79 |
|
| 80 |
CU_ASSERT(fx_eq10_channel != NULL); |
| 81 |
CU_ASSERT(AGS_RECALL_CHANNEL(fx_eq10_channel)->source == channel); |
| 82 |
|
| 83 |
CU_ASSERT(fx_eq10_channel->peak_28hz != NULL); |
| 84 |
CU_ASSERT(fx_eq10_channel->peak_56hz != NULL); |
| 85 |
CU_ASSERT(fx_eq10_channel->peak_112hz != NULL); |
| 86 |
CU_ASSERT(fx_eq10_channel->peak_224hz != NULL); |
| 87 |
CU_ASSERT(fx_eq10_channel->peak_448hz != NULL); |
| 88 |
CU_ASSERT(fx_eq10_channel->peak_896hz != NULL); |
| 89 |
CU_ASSERT(fx_eq10_channel->peak_1792hz != NULL); |
| 90 |
CU_ASSERT(fx_eq10_channel->peak_3584hz != NULL); |
| 91 |
CU_ASSERT(fx_eq10_channel->peak_7168hz != NULL); |
| 92 |
CU_ASSERT(fx_eq10_channel->peak_14336hz != NULL); |
| 93 |
CU_ASSERT(fx_eq10_channel->pressure != NULL); |
| 94 |
} |
| 95 |
|
| 96 |
void |
| 97 |
ags_fx_eq10_channel_test_dispose() |
| 98 |
{ |
| 99 |
AgsChannel *channel; |
| 100 |
AgsFxEq10Channel *fx_eq10_channel; |
| 101 |
|
| 102 |
channel = g_object_new(AGS_TYPE_CHANNEL, |
| 103 |
NULL); |
| 104 |
|
| 105 |
fx_eq10_channel = ags_fx_eq10_channel_new(channel); |
| 106 |
|
| 107 |
g_object_run_dispose(fx_eq10_channel); |
| 108 |
|
| 109 |
CU_ASSERT(fx_eq10_channel->peak_28hz == NULL); |
| 110 |
CU_ASSERT(fx_eq10_channel->peak_56hz == NULL); |
| 111 |
CU_ASSERT(fx_eq10_channel->peak_112hz == NULL); |
| 112 |
CU_ASSERT(fx_eq10_channel->peak_224hz == NULL); |
| 113 |
CU_ASSERT(fx_eq10_channel->peak_448hz == NULL); |
| 114 |
CU_ASSERT(fx_eq10_channel->peak_896hz == NULL); |
| 115 |
CU_ASSERT(fx_eq10_channel->peak_1792hz == NULL); |
| 116 |
CU_ASSERT(fx_eq10_channel->peak_3584hz == NULL); |
| 117 |
CU_ASSERT(fx_eq10_channel->peak_7168hz == NULL); |
| 118 |
CU_ASSERT(fx_eq10_channel->peak_14336hz == NULL); |
| 119 |
CU_ASSERT(fx_eq10_channel->pressure == NULL); |
| 120 |
|
| 121 |
g_object_unref(fx_eq10_channel); |
| 122 |
} |
| 123 |
|
| 124 |
void |
| 125 |
ags_fx_eq10_channel_test_finalize() |
| 126 |
{ |
| 127 |
AgsChannel *channel; |
| 128 |
AgsFxEq10Channel *fx_eq10_channel; |
| 129 |
|
| 130 |
GObjectClass *gobject_class; |
| 131 |
|
| 132 |
gpointer stub; |
| 133 |
|
| 134 |
|
| 135 |
channel = g_object_new(AGS_TYPE_CHANNEL, |
| 136 |
NULL); |
| 137 |
|
| 138 |
fx_eq10_channel = ags_fx_eq10_channel_new(channel); |
| 139 |
|
| 140 |
gobject_class = (GObjectClass *) g_type_class_ref(AGS_TYPE_FX_EQ10_CHANNEL); |
| 141 |
|
| 142 |
finalized = FALSE; |
| 143 |
|
| 144 |
stub = gobject_class->finalize; |
| 145 |
gobject_class->finalize = ags_fx_eq10_channel_stub_finalize; |
| 146 |
|
| 147 |
g_object_unref(fx_eq10_channel); |
| 148 |
|
| 149 |
CU_ASSERT(finalized == TRUE); |
| 150 |
|
| 151 |
gobject_class->finalize = stub; |
| 152 |
|
| 153 |
|
| 154 |
channel = g_object_new(AGS_TYPE_CHANNEL, |
| 155 |
NULL); |
| 156 |
|
| 157 |
fx_eq10_channel = ags_fx_eq10_channel_new(channel); |
| 158 |
|
| 159 |
g_object_unref(fx_eq10_channel); |
| 160 |
} |
| 161 |
|
| 162 |
int |
| 163 |
main(int argc, char **argv) |
| 164 |
{ |
| 165 |
CU_pSuite pSuite = NULL; |
| 166 |
|
| 167 |
putenv("LC_ALL=C"); |
| 168 |
putenv("LANG=C"); |
| 169 |
|
| 170 |
putenv("LADSPA_PATH=\"\""); |
| 171 |
putenv("DSSI_PATH=\"\""); |
| 172 |
putenv("LV2_PATH=\"\""); |
| 173 |
|
| 174 |
|
| 175 |
if(CUE_SUCCESS != CU_initialize_registry()){ |
| 176 |
return CU_get_error(); |
| 177 |
} |
| 178 |
|
| 179 |
|
| 180 |
pSuite = CU_add_suite("AgsFxEq10ChannelTest", ags_fx_eq10_channel_test_init_suite, ags_fx_eq10_channel_test_clean_suite); |
| 181 |
|
| 182 |
if(pSuite == NULL){ |
| 183 |
CU_cleanup_registry(); |
| 184 |
|
| 185 |
return CU_get_error(); |
| 186 |
} |
| 187 |
|
| 188 |
|
| 189 |
if((CU_add_test(pSuite, "test of AgsFxEq10Channel new", ags_fx_eq10_channel_test_new) == NULL) || |
| 190 |
(CU_add_test(pSuite, "test of AgsFxEq10Channel dispose", ags_fx_eq10_channel_test_dispose) == NULL) || |
| 191 |
(CU_add_test(pSuite, "test of AgsFxEq10Channel finalize", ags_fx_eq10_channel_test_finalize) == NULL)){ |
| 192 |
CU_cleanup_registry(); |
| 193 |
|
| 194 |
return CU_get_error(); |
| 195 |
} |
| 196 |
|
| 197 |
|
| 198 |
CU_basic_set_mode(CU_BRM_VERBOSE); |
| 199 |
CU_basic_run_tests(); |
| 200 |
|
| 201 |
CU_cleanup_registry(); |
| 202 |
|
| 203 |
return(CU_get_error()); |
| 204 |
} |