~ricmm/+junk/unity-lens_music-sc

« back to all changes in this revision

Viewing changes to tests/unit/test-rhythmbox-parser.c

  • Committer: Ricardo Mendoza
  • Date: 2012-09-05 14:20:15 UTC
  • Revision ID: ricardo.mendoza@canonical.com-20120905142015-prem6hiyfshwgm8q
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* test-rhythmbox-parser.c generated by valac 0.16.1, the Vala compiler
 
2
 * generated from test-rhythmbox-parser.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2012 Canonical Ltd
 
6
 *
 
7
 * This program is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License version 3 as
 
9
 * published by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 *
 
19
 * Authored by Didier Roche <didrocks@ubuntu.com>
 
20
 *
 
21
 */
 
22
 
 
23
#include <glib.h>
 
24
#include <glib-object.h>
 
25
#include <stdlib.h>
 
26
#include <string.h>
 
27
#include <gobject/gvaluecollector.h>
 
28
 
 
29
 
 
30
#define TYPE_MAIN (main_get_type ())
 
31
#define MAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN, Main))
 
32
#define MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN, MainClass))
 
33
#define IS_MAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN))
 
34
#define IS_MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN))
 
35
#define MAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN, MainClass))
 
36
 
 
37
typedef struct _Main Main;
 
38
typedef struct _MainClass MainClass;
 
39
typedef struct _MainPrivate MainPrivate;
 
40
 
 
41
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER (unity_music_lens_rhythmbox_collection_xml_parser_get_type ())
 
42
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER, UnityMusicLensRhythmboxCollectionXmlParser))
 
43
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER, UnityMusicLensRhythmboxCollectionXmlParserClass))
 
44
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_IS_XML_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER))
 
45
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_IS_XML_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER))
 
46
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER, UnityMusicLensRhythmboxCollectionXmlParserClass))
 
47
 
 
48
typedef struct _UnityMusicLensRhythmboxCollectionXmlParser UnityMusicLensRhythmboxCollectionXmlParser;
 
49
typedef struct _UnityMusicLensRhythmboxCollectionXmlParserClass UnityMusicLensRhythmboxCollectionXmlParserClass;
 
50
 
 
51
#define UNITY_MUSIC_LENS_TYPE_TRACK (unity_music_lens_track_get_type ())
 
52
#define UNITY_MUSIC_LENS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrack))
 
53
#define UNITY_MUSIC_LENS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
 
54
#define UNITY_MUSIC_LENS_IS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_TRACK))
 
55
#define UNITY_MUSIC_LENS_IS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_TRACK))
 
56
#define UNITY_MUSIC_LENS_TRACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
 
57
 
 
58
typedef struct _UnityMusicLensTrack UnityMusicLensTrack;
 
59
typedef struct _UnityMusicLensTrackClass UnityMusicLensTrackClass;
 
60
 
 
61
#define UNITY_MUSIC_LENS_TYPE_TRACK_TYPE (unity_music_lens_track_type_get_type ())
 
62
#define _g_free0(var) (var = (g_free (var), NULL))
 
63
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
64
typedef struct _ParamSpecMain ParamSpecMain;
 
65
 
 
66
struct _Main {
 
67
        GTypeInstance parent_instance;
 
68
        volatile int ref_count;
 
69
        MainPrivate * priv;
 
70
};
 
71
 
 
72
struct _MainClass {
 
73
        GTypeClass parent_class;
 
74
        void (*finalize) (Main *self);
 
75
};
 
76
 
 
77
typedef enum  {
 
78
        UNITY_MUSIC_LENS_TRACK_TYPE_SONG,
 
79
        UNITY_MUSIC_LENS_TRACK_TYPE_RADIO
 
80
} UnityMusicLensTrackType;
 
81
 
 
82
struct _ParamSpecMain {
 
83
        GParamSpec parent_instance;
 
84
};
 
85
 
 
86
 
 
87
static gpointer main_parent_class = NULL;
 
88
 
 
89
gpointer main_ref (gpointer instance);
 
90
void main_unref (gpointer instance);
 
91
GParamSpec* param_spec_main (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
 
92
void value_set_main (GValue* value, gpointer v_object);
 
93
void value_take_main (GValue* value, gpointer v_object);
 
94
gpointer value_get_main (const GValue* value);
 
95
GType main_get_type (void) G_GNUC_CONST;
 
96
enum  {
 
97
        MAIN_DUMMY_PROPERTY
 
98
};
 
99
gint main_main (gchar** args, int args_length1);
 
100
static void main_test_radios (void);
 
101
static void _main_test_radios_gtest_data_func (gpointer self);
 
102
static void main_test_songs (void);
 
103
static void _main_test_songs_gtest_data_func (gpointer self);
 
104
static void main_test_lazy_load (void);
 
105
static void _main_test_lazy_load_gtest_data_func (gpointer self);
 
106
static void main_test_invalid_tag (void);
 
107
static void _main_test_invalid_tag_gtest_data_func (gpointer self);
 
108
UnityMusicLensRhythmboxCollectionXmlParser* unity_music_lens_rhythmbox_collection_xml_parser_new (void);
 
109
UnityMusicLensRhythmboxCollectionXmlParser* unity_music_lens_rhythmbox_collection_xml_parser_construct (GType object_type);
 
110
GType unity_music_lens_rhythmbox_collection_xml_parser_get_type (void) G_GNUC_CONST;
 
111
GType unity_music_lens_track_get_type (void) G_GNUC_CONST;
 
112
static void __lambda9_ (UnityMusicLensTrack* track);
 
113
const gchar* unity_music_lens_track_get_title (UnityMusicLensTrack* self);
 
114
const gchar* unity_music_lens_track_get_genre (UnityMusicLensTrack* self);
 
115
const gchar* unity_music_lens_track_get_artist (UnityMusicLensTrack* self);
 
116
const gchar* unity_music_lens_track_get_album (UnityMusicLensTrack* self);
 
117
const gchar* unity_music_lens_track_get_uri (UnityMusicLensTrack* self);
 
118
gint unity_music_lens_track_get_year (UnityMusicLensTrack* self);
 
119
GType unity_music_lens_track_type_get_type (void) G_GNUC_CONST;
 
120
UnityMusicLensTrackType unity_music_lens_track_get_type_track (UnityMusicLensTrack* self);
 
121
static void ___lambda9__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self);
 
122
gboolean unity_music_lens_rhythmbox_collection_xml_parser_parse (UnityMusicLensRhythmboxCollectionXmlParser* self, const gchar* content, gsize len, GError** error);
 
123
static void __lambda10_ (UnityMusicLensTrack* track);
 
124
const gchar* unity_music_lens_track_get_mime_type (UnityMusicLensTrack* self);
 
125
static void ___lambda10__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self);
 
126
static void __lambda11_ (UnityMusicLensTrack* track);
 
127
static void ___lambda11__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self);
 
128
static void __lambda12_ (UnityMusicLensTrack* track);
 
129
static void ___lambda12__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self);
 
130
Main* main_new (void);
 
131
Main* main_construct (GType object_type);
 
132
static void main_finalize (Main* obj);
 
133
 
 
134
 
 
135
static void _main_test_radios_gtest_data_func (gpointer self) {
 
136
        main_test_radios ();
 
137
}
 
138
 
 
139
 
 
140
static void _main_test_songs_gtest_data_func (gpointer self) {
 
141
        main_test_songs ();
 
142
}
 
143
 
 
144
 
 
145
static void _main_test_lazy_load_gtest_data_func (gpointer self) {
 
146
        main_test_lazy_load ();
 
147
}
 
148
 
 
149
 
 
150
static void _main_test_invalid_tag_gtest_data_func (gpointer self) {
 
151
        main_test_invalid_tag ();
 
152
}
 
153
 
 
154
 
 
155
gint main_main (gchar** args, int args_length1) {
 
156
        gint result = 0;
 
157
        g_test_init (&args_length1, &args, NULL);
 
158
        g_test_add_data_func ("/Unit/ParserChecker/Radios", NULL, _main_test_radios_gtest_data_func);
 
159
        g_test_add_data_func ("/Unit/ParserChecker/Songs", NULL, _main_test_songs_gtest_data_func);
 
160
        g_test_add_data_func ("/Unit/ParserChecker/LazyLoad", NULL, _main_test_lazy_load_gtest_data_func);
 
161
        g_test_add_data_func ("/Unit/ParserChecker/InvalidTag", NULL, _main_test_invalid_tag_gtest_data_func);
 
162
        g_test_run ();
 
163
        result = 0;
 
164
        return result;
 
165
}
 
166
 
 
167
 
 
168
int main (int argc, char ** argv) {
 
169
        g_type_init ();
 
170
        return main_main (argv, argc);
 
171
}
 
172
 
 
173
 
 
174
static void __lambda9_ (UnityMusicLensTrack* track) {
 
175
        UnityMusicLensTrack* _tmp0_;
 
176
        const gchar* _tmp1_;
 
177
        const gchar* _tmp2_;
 
178
        UnityMusicLensTrack* _tmp3_;
 
179
        const gchar* _tmp4_;
 
180
        const gchar* _tmp5_;
 
181
        UnityMusicLensTrack* _tmp6_;
 
182
        const gchar* _tmp7_;
 
183
        const gchar* _tmp8_;
 
184
        UnityMusicLensTrack* _tmp9_;
 
185
        const gchar* _tmp10_;
 
186
        const gchar* _tmp11_;
 
187
        UnityMusicLensTrack* _tmp12_;
 
188
        const gchar* _tmp13_;
 
189
        const gchar* _tmp14_;
 
190
        UnityMusicLensTrack* _tmp15_;
 
191
        gint _tmp16_;
 
192
        gint _tmp17_;
 
193
        UnityMusicLensTrack* _tmp18_;
 
194
        UnityMusicLensTrackType _tmp19_;
 
195
        UnityMusicLensTrackType _tmp20_;
 
196
        g_return_if_fail (track != NULL);
 
197
        _tmp0_ = track;
 
198
        _tmp1_ = unity_music_lens_track_get_title (_tmp0_);
 
199
        _tmp2_ = _tmp1_;
 
200
        g_assert_cmpstr (_tmp2_, ==, "Absolute Radio 80s (Modem)");
 
201
        _tmp3_ = track;
 
202
        _tmp4_ = unity_music_lens_track_get_genre (_tmp3_);
 
203
        _tmp5_ = _tmp4_;
 
204
        g_assert_cmpstr (_tmp5_, ==, "other");
 
205
        _tmp6_ = track;
 
206
        _tmp7_ = unity_music_lens_track_get_artist (_tmp6_);
 
207
        _tmp8_ = _tmp7_;
 
208
        g_assert_cmpstr (_tmp8_, ==, "");
 
209
        _tmp9_ = track;
 
210
        _tmp10_ = unity_music_lens_track_get_album (_tmp9_);
 
211
        _tmp11_ = _tmp10_;
 
212
        g_assert_cmpstr (_tmp11_, ==, "");
 
213
        _tmp12_ = track;
 
214
        _tmp13_ = unity_music_lens_track_get_uri (_tmp12_);
 
215
        _tmp14_ = _tmp13_;
 
216
        g_assert_cmpstr (_tmp14_, ==, "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a8");
 
217
        _tmp15_ = track;
 
218
        _tmp16_ = unity_music_lens_track_get_year (_tmp15_);
 
219
        _tmp17_ = _tmp16_;
 
220
        g_assert_cmpint (_tmp17_, ==, 0);
 
221
        _tmp18_ = track;
 
222
        _tmp19_ = unity_music_lens_track_get_type_track (_tmp18_);
 
223
        _tmp20_ = _tmp19_;
 
224
        g_assert (_tmp20_ == UNITY_MUSIC_LENS_TRACK_TYPE_RADIO);
 
225
}
 
226
 
 
227
 
 
228
static void ___lambda9__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self) {
 
229
        __lambda9_ (track);
 
230
}
 
231
 
 
232
 
 
233
static void main_test_radios (void) {
 
234
        UnityMusicLensRhythmboxCollectionXmlParser* _tmp0_;
 
235
        UnityMusicLensRhythmboxCollectionXmlParser* parser;
 
236
        gchar* _tmp1_;
 
237
        gchar* collection_to_parse;
 
238
        gint _tmp2_;
 
239
        gint _tmp3_;
 
240
        GError * _inner_error_ = NULL;
 
241
        _tmp0_ = unity_music_lens_rhythmbox_collection_xml_parser_new ();
 
242
        parser = _tmp0_;
 
243
        _tmp1_ = g_strdup ("<?xml version=\"1.0\" standalone=\"yes\"?>\n" \
 
244
"<rhythmdb version=\"1.8\">\n" \
 
245
"  <entry type=\"iradio\">\n" \
 
246
"    <title>Absolute Radio 80s (Modem)</title>\n" \
 
247
"    <genre>80's</genre>\n" \
 
248
"    <artist></artist>\n" \
 
249
"    <album></album>\n" \
 
250
"    <location>http://network.absoluteradio.co.uk/core/audio/ogg/live.p" \
 
251
"ls?service=a8</location>\n" \
 
252
"    <play-count>6</play-count>\n" \
 
253
"    <last-played>1339693331</last-played>\n" \
 
254
"    <bitrate>32</bitrate>\n" \
 
255
"    <date>0</date>\n" \
 
256
"    <media-type>application/octet-stream</media-type>\n" \
 
257
"  </entry>\n" \
 
258
"</rhythmdb>");
 
259
        collection_to_parse = _tmp1_;
 
260
        g_signal_connect (parser, "track-info-ready", (GCallback) ___lambda9__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready, NULL);
 
261
        _tmp2_ = strlen (collection_to_parse);
 
262
        _tmp3_ = _tmp2_;
 
263
        unity_music_lens_rhythmbox_collection_xml_parser_parse (parser, collection_to_parse, (gsize) _tmp3_, &_inner_error_);
 
264
        if (_inner_error_ != NULL) {
 
265
                _g_free0 (collection_to_parse);
 
266
                _g_object_unref0 (parser);
 
267
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
268
                g_clear_error (&_inner_error_);
 
269
                return;
 
270
        }
 
271
        _g_free0 (collection_to_parse);
 
272
        _g_object_unref0 (parser);
 
273
}
 
274
 
 
275
 
 
276
static void __lambda10_ (UnityMusicLensTrack* track) {
 
277
        UnityMusicLensTrack* _tmp0_;
 
278
        const gchar* _tmp1_;
 
279
        const gchar* _tmp2_;
 
280
        UnityMusicLensTrack* _tmp3_;
 
281
        const gchar* _tmp4_;
 
282
        const gchar* _tmp5_;
 
283
        UnityMusicLensTrack* _tmp6_;
 
284
        const gchar* _tmp7_;
 
285
        const gchar* _tmp8_;
 
286
        UnityMusicLensTrack* _tmp9_;
 
287
        const gchar* _tmp10_;
 
288
        const gchar* _tmp11_;
 
289
        UnityMusicLensTrack* _tmp12_;
 
290
        const gchar* _tmp13_;
 
291
        const gchar* _tmp14_;
 
292
        UnityMusicLensTrack* _tmp15_;
 
293
        gint _tmp16_;
 
294
        gint _tmp17_;
 
295
        UnityMusicLensTrack* _tmp18_;
 
296
        const gchar* _tmp19_;
 
297
        const gchar* _tmp20_;
 
298
        UnityMusicLensTrack* _tmp21_;
 
299
        UnityMusicLensTrackType _tmp22_;
 
300
        UnityMusicLensTrackType _tmp23_;
 
301
        g_return_if_fail (track != NULL);
 
302
        _tmp0_ = track;
 
303
        _tmp1_ = unity_music_lens_track_get_title (_tmp0_);
 
304
        _tmp2_ = _tmp1_;
 
305
        g_assert_cmpstr (_tmp2_, ==, "LA PASSION");
 
306
        _tmp3_ = track;
 
307
        _tmp4_ = unity_music_lens_track_get_genre (_tmp3_);
 
308
        _tmp5_ = _tmp4_;
 
309
        g_assert_cmpstr (_tmp5_, ==, "techno");
 
310
        _tmp6_ = track;
 
311
        _tmp7_ = unity_music_lens_track_get_artist (_tmp6_);
 
312
        _tmp8_ = _tmp7_;
 
313
        g_assert_cmpstr (_tmp8_, ==, "GIGI D'AGOSTINO");
 
314
        _tmp9_ = track;
 
315
        _tmp10_ = unity_music_lens_track_get_album (_tmp9_);
 
316
        _tmp11_ = _tmp10_;
 
317
        g_assert_cmpstr (_tmp11_, ==, "Loulou 007");
 
318
        _tmp12_ = track;
 
319
        _tmp13_ = unity_music_lens_track_get_uri (_tmp12_);
 
320
        _tmp14_ = _tmp13_;
 
321
        g_assert_cmpstr (_tmp14_, ==, "file:///home/moi/Gigi%20d'agostino%20Passion.mp3");
 
322
        _tmp15_ = track;
 
323
        _tmp16_ = unity_music_lens_track_get_year (_tmp15_);
 
324
        _tmp17_ = _tmp16_;
 
325
        g_assert_cmpint (_tmp17_, ==, 2000);
 
326
        _tmp18_ = track;
 
327
        _tmp19_ = unity_music_lens_track_get_mime_type (_tmp18_);
 
328
        _tmp20_ = _tmp19_;
 
329
        g_assert_cmpstr (_tmp20_, ==, "audio/mpeg");
 
330
        _tmp21_ = track;
 
331
        _tmp22_ = unity_music_lens_track_get_type_track (_tmp21_);
 
332
        _tmp23_ = _tmp22_;
 
333
        g_assert (_tmp23_ == UNITY_MUSIC_LENS_TRACK_TYPE_SONG);
 
334
}
 
335
 
 
336
 
 
337
static void ___lambda10__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self) {
 
338
        __lambda10_ (track);
 
339
}
 
340
 
 
341
 
 
342
static void main_test_songs (void) {
 
343
        UnityMusicLensRhythmboxCollectionXmlParser* _tmp0_;
 
344
        UnityMusicLensRhythmboxCollectionXmlParser* parser;
 
345
        gchar* _tmp1_;
 
346
        gchar* collection_to_parse;
 
347
        gint _tmp2_;
 
348
        gint _tmp3_;
 
349
        GError * _inner_error_ = NULL;
 
350
        _tmp0_ = unity_music_lens_rhythmbox_collection_xml_parser_new ();
 
351
        parser = _tmp0_;
 
352
        _tmp1_ = g_strdup ("<?xml version=\"1.0\" standalone=\"yes\"?>\n" \
 
353
"<rhythmdb version=\"1.8\">\n" \
 
354
"  <entry type=\"song\">\n" \
 
355
"    <title>LA PASSION</title>\n" \
 
356
"    <genre>Dance</genre>\n" \
 
357
"    <artist>GIGI D'AGOSTINO</artist>\n" \
 
358
"    <album>Loulou 007</album>\n" \
 
359
"    <duration>228</duration>\n" \
 
360
"    <file-size>3661842</file-size>\n" \
 
361
"    <location>file:///home/moi/Gigi%20d'agostino%20Passion.mp3</locati" \
 
362
"on>\n" \
 
363
"    <mtime>1338273042</mtime>\n" \
 
364
"    <first-seen>1338536342</first-seen>\n" \
 
365
"    <last-seen>1340378542</last-seen>\n" \
 
366
"    <bitrate>128</bitrate>\n" \
 
367
"    <date>730142</date>\n" \
 
368
"    <media-type>audio/mpeg</media-type>\n" \
 
369
"    <comment>http://www.danceparadise.ca.tc</comment>\n" \
 
370
"  </entry>\n" \
 
371
"</rhythmdb>");
 
372
        collection_to_parse = _tmp1_;
 
373
        g_signal_connect (parser, "track-info-ready", (GCallback) ___lambda10__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready, NULL);
 
374
        _tmp2_ = strlen (collection_to_parse);
 
375
        _tmp3_ = _tmp2_;
 
376
        unity_music_lens_rhythmbox_collection_xml_parser_parse (parser, collection_to_parse, (gsize) _tmp3_, &_inner_error_);
 
377
        if (_inner_error_ != NULL) {
 
378
                _g_free0 (collection_to_parse);
 
379
                _g_object_unref0 (parser);
 
380
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
381
                g_clear_error (&_inner_error_);
 
382
                return;
 
383
        }
 
384
        _g_free0 (collection_to_parse);
 
385
        _g_object_unref0 (parser);
 
386
}
 
387
 
 
388
 
 
389
static void __lambda11_ (UnityMusicLensTrack* track) {
 
390
        UnityMusicLensTrack* _tmp0_;
 
391
        const gchar* _tmp1_;
 
392
        const gchar* _tmp2_;
 
393
        UnityMusicLensTrack* _tmp3_;
 
394
        const gchar* _tmp4_;
 
395
        const gchar* _tmp5_;
 
396
        UnityMusicLensTrack* _tmp6_;
 
397
        UnityMusicLensTrackType _tmp7_;
 
398
        UnityMusicLensTrackType _tmp8_;
 
399
        g_return_if_fail (track != NULL);
 
400
        _tmp0_ = track;
 
401
        _tmp1_ = unity_music_lens_track_get_title (_tmp0_);
 
402
        _tmp2_ = _tmp1_;
 
403
        g_assert_cmpstr (_tmp2_, ==, "LA PASSION");
 
404
        _tmp3_ = track;
 
405
        _tmp4_ = unity_music_lens_track_get_album (_tmp3_);
 
406
        _tmp5_ = _tmp4_;
 
407
        g_assert_cmpstr (_tmp5_, ==, "Loulou 007");
 
408
        _tmp6_ = track;
 
409
        _tmp7_ = unity_music_lens_track_get_type_track (_tmp6_);
 
410
        _tmp8_ = _tmp7_;
 
411
        g_assert (_tmp8_ == UNITY_MUSIC_LENS_TRACK_TYPE_SONG);
 
412
}
 
413
 
 
414
 
 
415
static void ___lambda11__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self) {
 
416
        __lambda11_ (track);
 
417
}
 
418
 
 
419
 
 
420
static void main_test_lazy_load (void) {
 
421
        UnityMusicLensRhythmboxCollectionXmlParser* _tmp0_;
 
422
        UnityMusicLensRhythmboxCollectionXmlParser* parser;
 
423
        gchar* _tmp1_;
 
424
        gchar* collection_to_parse_chunk;
 
425
        UnityMusicLensRhythmboxCollectionXmlParser* _tmp2_;
 
426
        const gchar* _tmp3_;
 
427
        const gchar* _tmp4_;
 
428
        gint _tmp5_;
 
429
        gint _tmp6_;
 
430
        gchar* _tmp7_;
 
431
        UnityMusicLensRhythmboxCollectionXmlParser* _tmp8_;
 
432
        UnityMusicLensRhythmboxCollectionXmlParser* _tmp9_;
 
433
        const gchar* _tmp10_;
 
434
        const gchar* _tmp11_;
 
435
        gint _tmp12_;
 
436
        gint _tmp13_;
 
437
        GError * _inner_error_ = NULL;
 
438
        _tmp0_ = unity_music_lens_rhythmbox_collection_xml_parser_new ();
 
439
        parser = _tmp0_;
 
440
        _tmp1_ = g_strdup ("<?xml version=\"1.0\" standalone=\"yes\"?>\n" \
 
441
"<rhythmdb version=\"1.8\">\n" \
 
442
"  <entry type=\"song\">\n" \
 
443
"    <title>LA PASSION</title>\n" \
 
444
"    <genre>Dance</genre>\n" \
 
445
"    <artist>GIGI D'AGOSTINO</artist>\n");
 
446
        collection_to_parse_chunk = _tmp1_;
 
447
        _tmp2_ = parser;
 
448
        _tmp3_ = collection_to_parse_chunk;
 
449
        _tmp4_ = collection_to_parse_chunk;
 
450
        _tmp5_ = strlen (_tmp4_);
 
451
        _tmp6_ = _tmp5_;
 
452
        unity_music_lens_rhythmbox_collection_xml_parser_parse (_tmp2_, _tmp3_, (gsize) _tmp6_, &_inner_error_);
 
453
        if (_inner_error_ != NULL) {
 
454
                _g_free0 (collection_to_parse_chunk);
 
455
                _g_object_unref0 (parser);
 
456
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
457
                g_clear_error (&_inner_error_);
 
458
                return;
 
459
        }
 
460
        _tmp7_ = g_strdup ("\n" \
 
461
"    <album>Loulou 007</album>\n" \
 
462
"    <duration>228</duration>\n" \
 
463
"    <file-size>3661842</file-size>\n" \
 
464
"    <location>file:///home/moi/Gigi%20d'agostino%20Passion.mp3</locati" \
 
465
"on>\n" \
 
466
"    <mtime>1338273042</mtime>\n" \
 
467
"    <first-seen>1338536342</first-seen>\n" \
 
468
"    <last-seen>1340378542</last-seen>\n" \
 
469
"    <bitrate>128</bitrate>\n" \
 
470
"    <date>730142</date>\n" \
 
471
"    <media-type>audio/mpeg</media-type>\n" \
 
472
"    <comment>http://www.danceparadise.ca.tc</comment>\n" \
 
473
"  </entry>");
 
474
        _g_free0 (collection_to_parse_chunk);
 
475
        collection_to_parse_chunk = _tmp7_;
 
476
        _tmp8_ = parser;
 
477
        g_signal_connect (_tmp8_, "track-info-ready", (GCallback) ___lambda11__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready, NULL);
 
478
        _tmp9_ = parser;
 
479
        _tmp10_ = collection_to_parse_chunk;
 
480
        _tmp11_ = collection_to_parse_chunk;
 
481
        _tmp12_ = strlen (_tmp11_);
 
482
        _tmp13_ = _tmp12_;
 
483
        unity_music_lens_rhythmbox_collection_xml_parser_parse (_tmp9_, _tmp10_, (gsize) _tmp13_, &_inner_error_);
 
484
        if (_inner_error_ != NULL) {
 
485
                _g_free0 (collection_to_parse_chunk);
 
486
                _g_object_unref0 (parser);
 
487
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
488
                g_clear_error (&_inner_error_);
 
489
                return;
 
490
        }
 
491
        _g_free0 (collection_to_parse_chunk);
 
492
        _g_object_unref0 (parser);
 
493
}
 
494
 
 
495
 
 
496
static void __lambda12_ (UnityMusicLensTrack* track) {
 
497
        UnityMusicLensTrack* _tmp0_;
 
498
        const gchar* _tmp1_;
 
499
        const gchar* _tmp2_;
 
500
        UnityMusicLensTrack* _tmp3_;
 
501
        UnityMusicLensTrackType _tmp4_;
 
502
        UnityMusicLensTrackType _tmp5_;
 
503
        g_return_if_fail (track != NULL);
 
504
        _tmp0_ = track;
 
505
        _tmp1_ = unity_music_lens_track_get_title (_tmp0_);
 
506
        _tmp2_ = _tmp1_;
 
507
        g_assert_cmpstr (_tmp2_, ==, "le poisson");
 
508
        _tmp3_ = track;
 
509
        _tmp4_ = unity_music_lens_track_get_type_track (_tmp3_);
 
510
        _tmp5_ = _tmp4_;
 
511
        g_assert (_tmp5_ == UNITY_MUSIC_LENS_TRACK_TYPE_SONG);
 
512
}
 
513
 
 
514
 
 
515
static void ___lambda12__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self) {
 
516
        __lambda12_ (track);
 
517
}
 
518
 
 
519
 
 
520
static void main_test_invalid_tag (void) {
 
521
        UnityMusicLensRhythmboxCollectionXmlParser* _tmp0_;
 
522
        UnityMusicLensRhythmboxCollectionXmlParser* parser;
 
523
        gchar* _tmp1_;
 
524
        gchar* collection_to_parse_chunk;
 
525
        gint _tmp2_;
 
526
        gint _tmp3_;
 
527
        GError * _inner_error_ = NULL;
 
528
        _tmp0_ = unity_music_lens_rhythmbox_collection_xml_parser_new ();
 
529
        parser = _tmp0_;
 
530
        _tmp1_ = g_strdup ("<?xml version=\"1.0\" standalone=\"yes\"?>\n" \
 
531
"<rhythmdb version=\"1.8\">\n" \
 
532
"  <entry type=\"song\">\n" \
 
533
"    <title>LA PASSION</title>\n" \
 
534
"    <genre>Dance</genre>\n" \
 
535
"  <entry type=\"song\">\n" \
 
536
"    <title>le poisson</title>\n" \
 
537
"    <genre>Dance</genre>\n" \
 
538
"  </entry>");
 
539
        collection_to_parse_chunk = _tmp1_;
 
540
        g_signal_connect (parser, "track-info-ready", (GCallback) ___lambda12__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready, NULL);
 
541
        _tmp2_ = strlen (collection_to_parse_chunk);
 
542
        _tmp3_ = _tmp2_;
 
543
        unity_music_lens_rhythmbox_collection_xml_parser_parse (parser, collection_to_parse_chunk, (gsize) _tmp3_, &_inner_error_);
 
544
        if (_inner_error_ != NULL) {
 
545
                _g_free0 (collection_to_parse_chunk);
 
546
                _g_object_unref0 (parser);
 
547
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
548
                g_clear_error (&_inner_error_);
 
549
                return;
 
550
        }
 
551
        _g_free0 (collection_to_parse_chunk);
 
552
        _g_object_unref0 (parser);
 
553
}
 
554
 
 
555
 
 
556
Main* main_construct (GType object_type) {
 
557
        Main* self = NULL;
 
558
        self = (Main*) g_type_create_instance (object_type);
 
559
        return self;
 
560
}
 
561
 
 
562
 
 
563
Main* main_new (void) {
 
564
        return main_construct (TYPE_MAIN);
 
565
}
 
566
 
 
567
 
 
568
static void value_main_init (GValue* value) {
 
569
        value->data[0].v_pointer = NULL;
 
570
}
 
571
 
 
572
 
 
573
static void value_main_free_value (GValue* value) {
 
574
        if (value->data[0].v_pointer) {
 
575
                main_unref (value->data[0].v_pointer);
 
576
        }
 
577
}
 
578
 
 
579
 
 
580
static void value_main_copy_value (const GValue* src_value, GValue* dest_value) {
 
581
        if (src_value->data[0].v_pointer) {
 
582
                dest_value->data[0].v_pointer = main_ref (src_value->data[0].v_pointer);
 
583
        } else {
 
584
                dest_value->data[0].v_pointer = NULL;
 
585
        }
 
586
}
 
587
 
 
588
 
 
589
static gpointer value_main_peek_pointer (const GValue* value) {
 
590
        return value->data[0].v_pointer;
 
591
}
 
592
 
 
593
 
 
594
static gchar* value_main_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
 
595
        if (collect_values[0].v_pointer) {
 
596
                Main* object;
 
597
                object = collect_values[0].v_pointer;
 
598
                if (object->parent_instance.g_class == NULL) {
 
599
                        return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
 
600
                } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
 
601
                        return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
 
602
                }
 
603
                value->data[0].v_pointer = main_ref (object);
 
604
        } else {
 
605
                value->data[0].v_pointer = NULL;
 
606
        }
 
607
        return NULL;
 
608
}
 
609
 
 
610
 
 
611
static gchar* value_main_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
 
612
        Main** object_p;
 
613
        object_p = collect_values[0].v_pointer;
 
614
        if (!object_p) {
 
615
                return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
 
616
        }
 
617
        if (!value->data[0].v_pointer) {
 
618
                *object_p = NULL;
 
619
        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
 
620
                *object_p = value->data[0].v_pointer;
 
621
        } else {
 
622
                *object_p = main_ref (value->data[0].v_pointer);
 
623
        }
 
624
        return NULL;
 
625
}
 
626
 
 
627
 
 
628
GParamSpec* param_spec_main (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
 
629
        ParamSpecMain* spec;
 
630
        g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAIN), NULL);
 
631
        spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
 
632
        G_PARAM_SPEC (spec)->value_type = object_type;
 
633
        return G_PARAM_SPEC (spec);
 
634
}
 
635
 
 
636
 
 
637
gpointer value_get_main (const GValue* value) {
 
638
        g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN), NULL);
 
639
        return value->data[0].v_pointer;
 
640
}
 
641
 
 
642
 
 
643
void value_set_main (GValue* value, gpointer v_object) {
 
644
        Main* old;
 
645
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN));
 
646
        old = value->data[0].v_pointer;
 
647
        if (v_object) {
 
648
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN));
 
649
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
 
650
                value->data[0].v_pointer = v_object;
 
651
                main_ref (value->data[0].v_pointer);
 
652
        } else {
 
653
                value->data[0].v_pointer = NULL;
 
654
        }
 
655
        if (old) {
 
656
                main_unref (old);
 
657
        }
 
658
}
 
659
 
 
660
 
 
661
void value_take_main (GValue* value, gpointer v_object) {
 
662
        Main* old;
 
663
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN));
 
664
        old = value->data[0].v_pointer;
 
665
        if (v_object) {
 
666
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN));
 
667
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
 
668
                value->data[0].v_pointer = v_object;
 
669
        } else {
 
670
                value->data[0].v_pointer = NULL;
 
671
        }
 
672
        if (old) {
 
673
                main_unref (old);
 
674
        }
 
675
}
 
676
 
 
677
 
 
678
static void main_class_init (MainClass * klass) {
 
679
        main_parent_class = g_type_class_peek_parent (klass);
 
680
        MAIN_CLASS (klass)->finalize = main_finalize;
 
681
}
 
682
 
 
683
 
 
684
static void main_instance_init (Main * self) {
 
685
        self->ref_count = 1;
 
686
}
 
687
 
 
688
 
 
689
static void main_finalize (Main* obj) {
 
690
        Main * self;
 
691
        self = MAIN (obj);
 
692
}
 
693
 
 
694
 
 
695
GType main_get_type (void) {
 
696
        static volatile gsize main_type_id__volatile = 0;
 
697
        if (g_once_init_enter (&main_type_id__volatile)) {
 
698
                static const GTypeValueTable g_define_type_value_table = { value_main_init, value_main_free_value, value_main_copy_value, value_main_peek_pointer, "p", value_main_collect_value, "p", value_main_lcopy_value };
 
699
                static const GTypeInfo g_define_type_info = { sizeof (MainClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Main), 0, (GInstanceInitFunc) main_instance_init, &g_define_type_value_table };
 
700
                static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
 
701
                GType main_type_id;
 
702
                main_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Main", &g_define_type_info, &g_define_type_fundamental_info, 0);
 
703
                g_once_init_leave (&main_type_id__volatile, main_type_id);
 
704
        }
 
705
        return main_type_id__volatile;
 
706
}
 
707
 
 
708
 
 
709
gpointer main_ref (gpointer instance) {
 
710
        Main* self;
 
711
        self = instance;
 
712
        g_atomic_int_inc (&self->ref_count);
 
713
        return instance;
 
714
}
 
715
 
 
716
 
 
717
void main_unref (gpointer instance) {
 
718
        Main* self;
 
719
        self = instance;
 
720
        if (g_atomic_int_dec_and_test (&self->ref_count)) {
 
721
                MAIN_GET_CLASS (self)->finalize (self);
 
722
                g_type_free_instance ((GTypeInstance *) self);
 
723
        }
 
724
}
 
725
 
 
726
 
 
727