[poppler] unit test for GLib bindings
Kouhei Sutou
kou at cozmixng.org
Mon Mar 23 07:43:16 PDT 2009
Hi,
In <1237736203.4174.8.camel at charmaleon>
"Re: [poppler] unit test for GLib bindings" on Sun, 22 Mar 2009 16:36:43 +0100,
Carlos Garcia Campos <carlosgc at gnome.org> wrote:
>> http://github.com/kou/poppler-test/tree/master
>>
>> It requires Cutter 1.0.6:
>> http://cutter.sourceforge.net/
>
> GLib has its own test framework since 2.16. I don't know it, and I don't
> know cutter either, what do you think about using the GLib test
> framework instead? cutter depends on glib, are they compatible somehow?
> I'm just asking, I don't have any problem with using cutter.
It seems that gtester is more simpler than Cutter and Cutter
provides more convenience features than gtester. I prefer to
Cutter because I want to write tests more easily. :-)
Here are comparing tables between gtester and Cutter:
item | gtester | Cutter
-----------------------------------------------------
<basic>
-----------------------------------------------------
based on | GLib | GLib/GObject
bundled | o | x
run model | a process per | a process for
| test case(*1) | all tests(*2)
| |
test program | executable program | shared library
test runner | optional | external program
| (self-executable) | ('cutter' command)
| ('gtester' command) |
| |
users | hundreds of | 6 projects
| projects?(*3) |
-----------------------------------------------------
(*1)
* Test process will continue even if a test program causes SEGV.
* Each test will have overhead to create a process.
(*2)
* Test process will stop a test case causes SEGV.
* Each test doesn't have overhead to create a process.
Continuity:
stop <-> continue
(*2) (*1)
Speed:
slow <-> first
(*1) (*2)
(*3) http://www.google.com/codesearch?q=g_test_run+lang%3Ac
-----------------------------------------------------
<document>
-----------------------------------------------------
tutorial | o(*4) | o(*5)
API reference | o(*6) | o(*7)
-----------------------------------------------------
(*4) http://mail.gnome.org/archives/gtk-devel-list/2007-December/msg00181.html
(*5) http://cutter.sourceforge.net/reference/tutorial.html
(*6) http://library.gnome.org/devel/glib/stable/glib-Testing.html
(*7) http://cutter.sourceforge.net/reference/reference.html
-----------------------------------------------------
<interface>
-----------------------------------------------------
test | required | auto-detect
registration | |
(*8) | |
| |
fixture(*9) | o | o
# of assertions| 15 | 58
text diff | x | o(*10)
image diff | x | o(*11)
backtrace | x | o(*12)
| |
well GLib | x | o(*13)
integrated | |
assertions | |
| |
data driven | x | o(*15)
test(*14) | |
-----------------------------------------------------
(*8) http://c2.com/cgi/wiki?TestCollector
(*9) http://en.wikipedia.org/wiki/Test_fixture
http://en.wikipedia.org/wiki/XUnit
(*10) http://cutter.sourceforge.net/reference/features.html
<Result output with useful format for debugging> section
(*11) http://cutter.sourceforge.net/reference/news.html
<1.0.5: 2008-10-15> section
http://github.com/kou/poppler-test/blob/4bb8d22914a988ae5da9ba5f46199bf521cfd2b6/glib/test/test-page.c#L287
(*12) http://cutter.sourceforge.net/reference/cutter-cut-helper.html#cut-trace
(*13) http://cutter.sourceforge.net/reference/cutter-gcut-assertions.html
e.g. GHashTable of String -> String will be inspected
like '{"key1" => "value1", "key2" => "value2"}' not
'#<GHashTable: 0xXXXXX>' when assertions is failed.
(*14) QtTest's documentation:
http://doc.trolltech.com/solutions/4/qttestlib/tutorial2.html
(*15) http://cutter.sourceforge.net/reference/cutter-cutter.html#cut-add-data
http://cutter.sourceforge.net/reference/cutter-gcut-data.html#gcut-add-datum
>> The tests covers all functions in glib/test-poppler-glib.cc
>> except nested layer case. Is there a sample nested layer
>> PDF?
>
> Yes, here is one:
>
> http://people.freedesktop.org/~carlosgc/NestedLayers.pdf
Thanks!
I've add a test for poppler_layers_iter_get_child() and
poppler_layers_iter_get_title() and push it to github.
But the test PDF doesn't have iter's title. So,
poppler_layers_iter_get_title() always returns NULL...
Thanks,
--
kou
More information about the poppler
mailing list