[POS-commit] CVS: Kiwi/tests test_CListDelegate.py,1.30,1.31

Christian Reis kiko at async.com.br
Fri Feb 7 15:37:45 BRDT 2003


Update of /cvs/Kiwi/tests
In directory anthem:/tmp/cvs-serv29021/tests

Modified Files:
	test_CListDelegate.py 
Log Message:
Implement formats for datetime in CListDelegate/CList, which allows us
to sort precisely by the format specified in the Column constructor.
This solves a problem with the previous implementation where sorting
only used DateTimeFrom, which is quite slow.

I also fixed a very silly bug that occured when tainted was set. It
was reversing the lines and then re-reversing, the effect being it
appeared to not sort. Keeps your eyes open when looking at wierd if
statements.

Also optimized taint to not strike us when we were doing
insert_sorted(), since we can be sure the method itself doesn't break
the sort in any way.


Index: test_CListDelegate.py
===================================================================
RCS file: /cvs/Kiwi/tests/test_CListDelegate.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- test_CListDelegate.py	7 Feb 2003 13:12:50 -0000	1.30
+++ test_CListDelegate.py	7 Feb 2003 16:37:42 -0000	1.31
@@ -82,22 +82,23 @@
 p = Person("Christian Robottom Reis", "SHIS QL 20 Conj. 4 Casa 18 Lago Sul",
            23, None, 443242.33, 1, TRUE, DateTime.now())
 pl.append(p)
-p = Person("Johan Dahlin", "R. Thomaz Antonio Gonzaga 75 Ap. 22",
-           2, "M", 223.33, 2, FALSE, DateTime.DateFrom("16 February 1976"))
+p = Person("Johan Dahlin", "R. Thomaz Antonio Gonzaga 75 Ap. 22", 
+           2, "M", 223.33, 2, FALSE, 
+           DateTime.DateTimeFrom("20020701"))
 pl.append(p)
 # Pedro here is an example: we insert None as his value for "cool", but
 # it is read out as being 3 because of the pixhash. This prints out a
 # warning.
-p = Person("Pedro Bó", None, 21, "X", 666.66, 2, None,
-            DateTime.DateFrom("3 May 1977"))
+p = Person("Pedro Bó", None, 21, "X", 666.66, 2, TRUE,
+            DateTime.DateFrom("20020704"))
 pl.append(p)
-p = Person("Xico Sergio", None, 99, "X", 1, 0, None,
-           DateTime.DateFrom("4 March 1949"))
+p = Person("Xico Sergio", None, 99, "X", 1, 0, FALSE,
+           DateTime.DateFrom("20020301"))
 pl.append(p)
 # Manuela is an authentic user of the empty "cool": she supplies the
 # value 3.
 p = Person("Manuela Tiça", "R. dos Carvalhos, 532, Santa Rita do Passa Quatro",
-           84, "M", None, 3, TRUE, DateTime.DateFrom("6 September 1953"))
+           84, "M", None, 3, TRUE, DateTime.DateFrom("20020309"))
 pl.append(p)
 p = Person("Maria Juana", "Foo me Foo", None, "X", None, 1, TRUE,
             None)
@@ -128,7 +129,7 @@
                     title="Foo XPM", pixmap_spec=pixhash),
             Column("true", title_pixmap="bar.xpm", 
                     title="Bar XPM", pixmap_spec=pixhash2),
-            Column("date", title="DATE MOO")
+            Column("date", title="DATE MOO", format="%d/%m/%Y")
            ]
 
 try:
@@ -171,6 +172,7 @@
 b = gtk.GtkButton("Add list")
 b.show()
 b.connect("clicked", add_list)
+gtk.idle_add(b.clicked)
 v.add(b)
 v.set_child_packing(b, FALSE, FALSE, FALSE, FALSE)
 b = gtk.GtkButton("Substitute list")
@@ -195,6 +197,7 @@
 v.show()
 w.show()
 w.set_usize(500,400)
+
 gtk.mainloop()
 print "-"*80
 print cp.dump_column_code()



More information about the POS-commit mailing list