@@ -392,5 +392,102 @@ Item {
392392 }
393393 closePreview();
394394 }
395+
396+ function test_departments() {
397+ var dashDepartments = findChild(dashContent, "dashDepartments");
398+ compare(dashDepartments.visible, true);
399+ compare(dashDepartments.showList, false);
400+ waitForRendering(dashDepartments);
401+ mouseClick(dashDepartments, 0, 0);
402+ compare(dashDepartments.showList, true);
403+
404+ var departmentListView = findChild(dashDepartments, "departmentListView");
405+ compare(departmentListView.count, 1);
406+ tryCompare(departmentListView.currentItem.department, "loaded", true);
407+
408+ waitForRendering(departmentListView);
409+ waitForRendering(departmentListView.currentItem);
410+
411+ var allButton = findChild(dashDepartments, "allButton");
412+ compare(allButton.visible, false);
413+
414+ var department = findChild(dashDepartments, "department0child3");
415+ mouseClick(department, 0, 0);
416+ compare(dashDepartments.showList, false);
417+ tryCompare(dashDepartments.currentDepartment, "departmentId", "middle3");
418+ tryCompare(departmentListView.currentItem.department, "departmentId", "root");
419+
420+ mouseClick(dashDepartments, 0, 0);
421+ compare(dashDepartments.showList, true);
422+ waitForRendering(departmentListView);
423+ waitForRendering(departmentListView.currentItem);
424+ compare(allButton.visible, true);
425+
426+ mouseClick(allButton, 0, 0);
427+ compare(dashDepartments.showList, false);
428+ tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
429+ tryCompare(departmentListView.currentItem.department, "departmentId", "root");
430+
431+ mouseClick(dashDepartments, 0, 0);
432+ compare(dashDepartments.showList, true);
433+ waitForRendering(departmentListView);
434+ waitForRendering(departmentListView.currentItem);
435+ compare(allButton.visible, false);
436+
437+ department = findChild(dashDepartments, "department0child2");
438+ mouseClick(department, 0, 0);
439+ compare(dashDepartments.showList, true);
440+ tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
441+ tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
442+
443+ var departmentList1 = findChild(dashDepartments, "department1");
444+ allButton = findChild(departmentList1, "allButton");
445+ var backButton = findChild(findChild(departmentList1, "department1"), "backButton");
446+ compare(allButton.visible, true);
447+ compare(backButton.visible, true);
448+
449+ mouseClick(allButton, 0, 0);
450+ compare(dashDepartments.showList, false);
451+ tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
452+ tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
453+
454+ mouseClick(dashDepartments, 0, 0);
455+ compare(dashDepartments.showList, true);
456+ waitForRendering(departmentListView);
457+ waitForRendering(departmentListView.currentItem);
458+ compare(allButton.visible, true);
459+ compare(backButton.visible, true);
460+
461+ tryCompare(departmentList1.department, "loaded", true);
462+ department = findChild(dashDepartments, "department1child2");
463+ mouseClick(department, 0, 0);
464+ compare(dashDepartments.showList, false);
465+ tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle22");
466+ tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
467+
468+ mouseClick(dashDepartments, 0, 0);
469+ compare(dashDepartments.showList, true);
470+ waitForRendering(departmentListView);
471+ waitForRendering(departmentListView.currentItem);
472+
473+ tryCompare(departmentList1.department, "loaded", true);
474+ department = findChild(dashDepartments, "department1child3");
475+ mouseClick(department, 0, 0);
476+ compare(dashDepartments.showList, false);
477+ tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle23");
478+ tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
479+
480+ mouseClick(dashDepartments, 0, 0);
481+ compare(dashDepartments.showList, true);
482+ waitForRendering(departmentListView);
483+ waitForRendering(departmentListView.currentItem);
484+ mouseClick(backButton, 0, 0);
485+
486+ tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
487+ tryCompare(departmentListView.currentItem.department, "departmentId", "root");
488+ compare(dashDepartments.showList, true);
489+ mouseClick(dashDepartments, 0, 0);
490+ compare(dashDepartments.showList, false);
491+ }
395492 }
396493}