[poppler] unit test for GLib bindings
Carlos Garcia Campos
carlosgc at gnome.org
Sat Apr 25 10:16:00 PDT 2009
El sáb, 25-04-2009 a las 23:53 +0900, Kouhei Sutou escribió:
> Hi,
>
> In <1240670612.4223.8.camel at charmaleon>
> "Re: [poppler] unit test for GLib bindings" on Sat, 25 Apr 2009 16:43:32 +0200,
> Carlos Garcia Campos <carlosgc at gnome.org> wrote:
>
> > I don't think expected is destroyed, the problem is that checksum is
> > optional, so it might be NULL. In this case since checksum is a GString
> > ->str is what is NULL. So in the test we are passing NULL to
> > g_string_append_printf:
> >
> > g_string_append_printf (string, "checksum=<%s>",
> > attachment->checksum->str);
>
> Is the test passed with the patch? (please revert the
> previous patch.)
>
> diff --git a/glib/test/test-document.c b/glib/test/test-document.c
> index 117b314..d05da69 100644
> --- a/glib/test/test-document.c
> +++ b/glib/test/test-document.c
> @@ -497,13 +497,18 @@ attachment_equal (gconstpointer data1, gconstpointer data2)
> const PopplerAttachment *attachment1 = data1;
> const PopplerAttachment *attachment2 = data2;
>
> + if ((attachment1->checksum != attachment2->checksum) &&
> + (attachment1->checksum == NULL || attachment2->checksum == NULL))
> + return FALSE;
> +
> return
> cut_equal_string (attachment1->name, attachment2->name) &&
> cut_equal_string (attachment1->description, attachment2->description) &&
> attachment1->size == attachment2->size &&
> attachment1->mtime == attachment2->mtime &&
> attachment1->ctime == attachment2->ctime &&
> - cut_equal_string (attachment1->checksum->str, attachment2->checksum->str);
> + (attachment1->checksum == attachment2->checksum ||
> + cut_equal_string (attachment1->checksum->str, attachment2->checksum->str));
this shouldn't be affected, since there's a return above.
> }
>
> static void
> @@ -518,7 +523,8 @@ attachment_inspect (GString *string, gconstpointer data, gpointer user_data)
> attachment->size);
> g_string_append_printf (string, "mtime=<%d>, ", attachment->mtime);
> g_string_append_printf (string, "ctime=<%d>, ", attachment->ctime);
> - g_string_append_printf (string, "checksum=<%s>", attachment->checksum->str);
> + g_string_append_printf (string, "checksum=<%s>",
> + attachment->checksum ? attachment->checksum->str : "NULL");
> g_string_append (string, ">");
> }
still crashes. I've noticed that the checksum string is created even
when there isn't a checksum, I've just fixed it.
isn't it reproducible for you?
>
> Thanks,
> --
> kou
--
Carlos Garcia Campos
elkalmail at yahoo.es
carlosgc at gnome.org
http://carlosgc.linups.org
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
digitalmente
Url : http://lists.freedesktop.org/archives/poppler/attachments/20090425/2c28d64b/attachment.pgp
More information about the poppler
mailing list