* plugins/TestcaseGenerator.py: Generate new Note objects
svn: r8211
This commit is contained in:
parent
29776e25b8
commit
83bb583b3e
@ -1,3 +1,6 @@
|
|||||||
|
2007-02-22 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
|
* plugins/TestcaseGenerator.py: Generate new Note objects
|
||||||
|
|
||||||
2007-02-22 Alex Roitman <shura@gramps-project.org>
|
2007-02-22 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/GrampsDb/_GrampsBSDDB.py (reindex_reference_map): Typo.
|
* src/GrampsDb/_GrampsBSDDB.py (reindex_reference_map): Typo.
|
||||||
* src/GrampsDb/_GrampsDbWriteXML.py (write_media_list): Typo.
|
* src/GrampsDb/_GrampsDbWriteXML.py (write_media_list): Typo.
|
||||||
|
@ -87,6 +87,7 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
self.generated_places = []
|
self.generated_places = []
|
||||||
self.generated_events = []
|
self.generated_events = []
|
||||||
self.generated_families = []
|
self.generated_families = []
|
||||||
|
self.generated_notes = []
|
||||||
self.text_serial_number = 1
|
self.text_serial_number = 1
|
||||||
|
|
||||||
# If an active persons exists the generated tree is connected to that person
|
# If an active persons exists the generated tree is connected to that person
|
||||||
@ -1193,9 +1194,20 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
if isinstance(o,RelLib.Name):
|
if isinstance(o,RelLib.Name):
|
||||||
o.set_type( self.rand_type( RelLib.NameType()))
|
o.set_type( self.rand_type( RelLib.NameType()))
|
||||||
|
|
||||||
|
if isinstance(o,RelLib.Note):
|
||||||
|
o.set( self.rand_text(self.NOTE))
|
||||||
|
o.set_format( choice( (RelLib.Note.FLOWED,RelLib.Note.FORMATTED)))
|
||||||
|
o.set_type( self.rand_type(RelLib.NoteType()))
|
||||||
|
|
||||||
if issubclass(o.__class__,RelLib._NoteBase.NoteBase):
|
if issubclass(o.__class__,RelLib._NoteBase.NoteBase):
|
||||||
o.set_note( self.rand_text(self.NOTE))
|
while randint(0,1) == 1:
|
||||||
o.set_note_format( choice( (True,False)))
|
if not self.generated_notes or randint(0,10) == 1:
|
||||||
|
n = RelLib.Note()
|
||||||
|
self.fill_object(n)
|
||||||
|
self.db.add_note( n, self.trans)
|
||||||
|
self.generated_notes.append( n.get_handle())
|
||||||
|
n_h = choice(self.generated_notes)
|
||||||
|
o.add_note(n_h)
|
||||||
|
|
||||||
if isinstance(o,RelLib.Place):
|
if isinstance(o,RelLib.Place):
|
||||||
o.set_title( self.rand_text(self.SHORT))
|
o.set_title( self.rand_text(self.SHORT))
|
||||||
@ -1409,13 +1421,19 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
word = word + choice(syllables)
|
word = word + choice(syllables)
|
||||||
if type == self.FIRSTNAME_MALE:
|
if type == self.FIRSTNAME_MALE:
|
||||||
word = word + choice(("a","e","i","o","u"))
|
word = word + choice(("a","e","i","o","u"))
|
||||||
elif type == self.NOTE:
|
if randint(0,3) == 1:
|
||||||
|
word = word.title()
|
||||||
|
if type == self.NOTE:
|
||||||
|
if randint(0,10) == 1:
|
||||||
|
word = "<b>%s</b>" % word
|
||||||
|
elif randint(0,10) == 1:
|
||||||
|
word = "<i>%s</i>" % word
|
||||||
|
elif randint(0,10) == 1:
|
||||||
|
word = "<i>%s</i>" % word
|
||||||
if randint(0,20) == 1:
|
if randint(0,20) == 1:
|
||||||
word = word + "."
|
word = word + "."
|
||||||
elif randint(0,30) == 1:
|
elif randint(0,30) == 1:
|
||||||
word = word + ".\n"
|
word = word + ".\n"
|
||||||
if randint(0,3) == 1:
|
|
||||||
word = word.title()
|
|
||||||
result = result + word
|
result = result + word
|
||||||
|
|
||||||
if type == self.LASTNAME:
|
if type == self.LASTNAME:
|
||||||
|
Loading…
Reference in New Issue
Block a user