From d44d8c8277e0f968d54d5d0035b31dadd796378a Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Fri, 7 Oct 2005 13:37:59 +0000 Subject: [PATCH] * src/plugins/TestcaseGenerator.py: Feed in more data svn: r5289 --- gramps2/ChangeLog | 3 ++ gramps2/src/plugins/TestcaseGenerator.py | 39 ++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 41635eb0c..92d617d45 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,6 @@ +2005-10-07 Martin Hawlisch + * src/plugins/TestcaseGenerator.py: Feed in more data + 2005-10-07 Alex Roitman * doc/gramps-manual/C/cmdplug.xml: Add new section documenting plugin options (Reports and Tools). diff --git a/gramps2/src/plugins/TestcaseGenerator.py b/gramps2/src/plugins/TestcaseGenerator.py index 26bcc1cad..7fb00af81 100644 --- a/gramps2/src/plugins/TestcaseGenerator.py +++ b/gramps2/src/plugins/TestcaseGenerator.py @@ -271,21 +271,43 @@ class TestcaseGenerator(Tool.Tool): or self.options.handler.options_dict['dates']\ or self.options.handler.options_dict['persons']: + self.default_url = RelLib.Url() + self.default_url.set_path("http://www.gramps-project.org/") + self.default_url.set_description("GRAMPS Project Homepage") self.default_source = RelLib.Source() self.default_source.set_title("TestcaseGenerator") + self.default_source.set_note("Generated by TestcaseGenerator") + self.default_source.set_data_item("Testcase Attribute", "Value test") self.db.add_source(self.default_source, self.trans) self.default_sourceref = RelLib.SourceRef() self.default_sourceref.set_base_handle(self.default_source.get_handle()) - self.default_place = RelLib.Place() - self.default_place.set_title("TestcaseGenerator place") - self.db.add_place(self.default_place, self.trans) + self.default_attribute = RelLib.Attribute() + self.default_attribute.set_type("Testcase Attribute") + self.default_attribute.set_value("Value test") + self.default_attribute.set_note("Generated by TestcaseGenerator") + self.default_attribute.add_source_reference(self.default_sourceref) self.default_media = RelLib.MediaObject() self.default_media.set_description("TestcaseGenerator media") self.default_media.set_path("/tmp/TestcaseGenerator.png") self.default_media.set_mime_type("image/png") + self.default_media.set_note("Generated by TestcaseGenerator") + self.default_media.add_source_reference(self.default_sourceref) + self.default_media.add_attribute(self.default_attribute) self.db.add_object(self.default_media, self.trans) self.default_mediaref = RelLib.MediaRef() self.default_mediaref.set_reference_handle(self.default_media.get_handle()) + self.default_mediaref.set_note("Generated by TestcaseGenerator") + self.default_mediaref.add_source_reference(self.default_sourceref) + self.default_mediaref.add_attribute(self.default_attribute) + self.default_source.add_media_reference(self.default_mediaref) + self.db.commit_source(self.default_source, self.trans) + self.default_place = RelLib.Place() + self.default_place.set_title("TestcaseGenerator place") + self.default_place.set_note("Generated by TestcaseGenerator") + self.default_place.add_source_reference(self.default_sourceref) + self.default_place.add_media_reference(self.default_mediaref) + self.default_place.add_url(self.default_url) + self.db.add_place(self.default_place, self.trans) if self.options.handler.options_dict['bugs']: self.generate_broken_relations() @@ -800,9 +822,20 @@ class TestcaseGenerator(Tool.Tool): object.add_media_reference(self.default_mediaref) e = RelLib.Event() e.set_name("TestcaseGenerator") + e.set_note("Generated by TestcaseGenerator") + e.set_cause("Test cause") + e.set_description("Test description") + e.add_source_reference(self.default_sourceref) + e.add_media_reference(self.default_mediaref) e.set_place_handle(self.default_place.get_handle()) self.db.add_event(e, self.trans) object.add_event_handle(e.get_handle()) + object.add_attribute( self.default_attribute) + try: + object.add_url(self.default_url) + except AttributeError: + pass # family does not have an url + object.set_note("Generated by TestcaseGenerator") def commit_transaction(self): if self.options.handler.options_dict['no_trans']: