288 listview->setSorting( 0, FALSE ); |
291 listview->setSorting( 0, FALSE ); |
289 QVERIFY( item == listview->firstChild() ); |
292 QVERIFY( item == listview->firstChild() ); |
290 |
293 |
291 delete listview; |
294 delete listview; |
292 } |
295 } |
|
296 |
|
297 void tst_Q3ListView::sortchild2() |
|
298 { |
|
299 Q3ListView* listview = new Q3ListView( 0 ); |
|
300 |
|
301 listview->addColumn( "" ); |
|
302 |
|
303 Q3ListViewItem* item1 = new Q3ListViewItem( listview, "zzz" ); |
|
304 Q3ListViewItem* item2 = new Q3ListViewItem( listview, "hhh" ); |
|
305 Q3ListViewItem* item3 = new Q3ListViewItem( listview, "bbb" ); |
|
306 Q3ListViewItem* item4 = new Q3ListViewItem( listview, "jjj" ); |
|
307 Q3ListViewItem* item5 = new Q3ListViewItem( listview, "ddd" ); |
|
308 Q3ListViewItem* item6 = new Q3ListViewItem( listview, "lll" ); |
|
309 |
|
310 Q3ListViewItem* item31 = new Q3ListViewItem( item3, "bbb-level2" ); |
|
311 |
|
312 Q3ListViewItem* item31b = new Q3ListViewItem( item31, "234" ); |
|
313 Q3ListViewItem* item31c = new Q3ListViewItem( item31, "345" ); |
|
314 Q3ListViewItem* item31a = new Q3ListViewItem( item31, "123" ); |
|
315 |
|
316 listview->setOpen( item3, TRUE ); |
|
317 listview->setOpen( item31, TRUE ); |
|
318 |
|
319 listview->setSorting( 0, TRUE ); |
|
320 listview->show(); |
|
321 |
|
322 Q3ListViewItem *item = listview->firstChild(); |
|
323 QVERIFY( item == item3 ); |
|
324 item = item->itemBelow(); |
|
325 QVERIFY( item == item31 ); |
|
326 item = item->itemBelow(); |
|
327 QVERIFY( item == item31a ); |
|
328 item = item->itemBelow(); |
|
329 QVERIFY( item == item31b ); |
|
330 item = item->itemBelow(); |
|
331 QVERIFY( item == item31c ); |
|
332 item = item->itemBelow(); |
|
333 QVERIFY( item == item5 ); |
|
334 item = item->itemBelow(); |
|
335 QVERIFY( item == item2 ); |
|
336 item = item->itemBelow(); |
|
337 QVERIFY( item == item4 ); |
|
338 item = item->itemBelow(); |
|
339 QVERIFY( item == item6 ); |
|
340 item = item->itemBelow(); |
|
341 QVERIFY( item == item1 ); |
|
342 |
|
343 listview->setSorting( 0, FALSE ); |
|
344 |
|
345 item = listview->firstChild(); |
|
346 QVERIFY( item == item1 ); |
|
347 item = item->itemBelow(); |
|
348 QVERIFY( item == item6 ); |
|
349 item = item->itemBelow(); |
|
350 QVERIFY( item == item4 ); |
|
351 item = item->itemBelow(); |
|
352 QVERIFY( item == item2 ); |
|
353 item = item->itemBelow(); |
|
354 QVERIFY( item == item5 ); |
|
355 item = item->itemBelow(); |
|
356 QVERIFY( item == item3 ); |
|
357 item = item->itemBelow(); |
|
358 QVERIFY( item == item31 ); |
|
359 item = item->itemBelow(); |
|
360 QVERIFY( item == item31c ); |
|
361 item = item->itemBelow(); |
|
362 QVERIFY( item == item31b ); |
|
363 item = item->itemBelow(); |
|
364 QVERIFY( item == item31a ); |
|
365 |
|
366 item = listview->firstChild(); |
|
367 item->moveItem( item->itemBelow() ); |
|
368 |
|
369 listview->setSorting( 0, FALSE ); |
|
370 QVERIFY( item == listview->firstChild() ); |
|
371 |
|
372 delete listview; |
|
373 } |
|
374 |
|
375 void tst_Q3ListView::sortchild3() |
|
376 { |
|
377 Q3ListView* listview = new Q3ListView( 0 ); |
|
378 |
|
379 listview->addColumn( "" ); |
|
380 |
|
381 Q3ListViewItem* item3 = new Q3ListViewItem( listview, "bbb" ); |
|
382 |
|
383 |
|
384 Q3ListViewItem* item31b = new Q3ListViewItem( item3, "234" ); |
|
385 Q3ListViewItem* item31c = new Q3ListViewItem( item3, "345" ); |
|
386 Q3ListViewItem* item31a = new Q3ListViewItem( item3, "123" ); |
|
387 |
|
388 listview->setOpen( item3, TRUE ); |
|
389 |
|
390 listview->setSorting( 0, TRUE ); |
|
391 listview->show(); |
|
392 |
|
393 Q3ListViewItem *item = listview->firstChild(); |
|
394 QVERIFY( item == item3 ); |
|
395 item = item->itemBelow(); |
|
396 QVERIFY( item == item31a ); |
|
397 item = item->itemBelow(); |
|
398 QVERIFY( item == item31b ); |
|
399 item = item->itemBelow(); |
|
400 QVERIFY( item == item31c ); |
|
401 item = item->itemBelow(); |
|
402 |
|
403 listview->setSorting( 0, FALSE ); |
|
404 |
|
405 item = listview->firstChild(); |
|
406 QVERIFY( item == item3 ); |
|
407 item = item->itemBelow(); |
|
408 QVERIFY( item == item31c ); |
|
409 item = item->itemBelow(); |
|
410 QVERIFY( item == item31b ); |
|
411 item = item->itemBelow(); |
|
412 QVERIFY( item == item31a ); |
|
413 |
|
414 delete listview; |
|
415 } |
|
416 |
293 |
417 |
294 void tst_Q3ListView::takeItem_data() |
418 void tst_Q3ListView::takeItem_data() |
295 { |
419 { |
296 QTest::addColumn<Q3ListView::SelectionMode>("selectionMode"); |
420 QTest::addColumn<Q3ListView::SelectionMode>("selectionMode"); |
297 QTest::addColumn<int>("selectItem"); |
421 QTest::addColumn<int>("selectItem"); |