Index: openacs-4/packages/xowiki/tcl/test/includelet-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/test/includelet-test-procs.tcl,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/xowiki/tcl/test/includelet-test-procs.tcl 7 Mar 2022 19:00:24 -0000 1.1.2.3 +++ openacs-4/packages/xowiki/tcl/test/includelet-test-procs.tcl 8 Mar 2022 08:52:10 -0000 1.1.2.4 @@ -14,7 +14,7 @@ } \ includelet_toc { - test toc includelet. + Test includelet "toc". } { set system_locale [lang::system::locale] @@ -53,8 +53,7 @@ } { set id($po) [xowiki::test::require_page \ -page_order $po \ - en:p$po \ - $f_id $package_id] + en:p$po $f_id $package_id] } ::xo::db::CrClass get_instance_from_db -item_id $id(1) @@ -93,3 +92,99 @@ # site_node::delete -node_id $node_id -delete_package } } + + +aa_register_case \ + -cats {smoke production_safe} \ + -procs { + "::acs::test::require_package_instance" + "::xo::PackageMgr instproc initialize" + "::xowiki::Page instproc include" + + "::xo::OrderedComposite instproc __compare" + "::xowiki::FormPage proc get_all_children" + "::xowiki::includelet::child-resources instproc render" + } \ + includelet_childresources { + + Test includelet "child-resources". In particular this tests + the effects of ns_strcoll (when available) for UTF-8 collation + sequence. Notice, that the C-library is differently + implemented in e.g. Linux and BSD* systems, but for the used test + case it should be identical. + + } { + set system_locale [lang::system::locale] + set instance /xowiki-test + set package_id [::acs::test::require_package_instance \ + -package_key xowiki \ + -empty \ + -instance_name $instance] + try { + + ::xowiki::Package initialize -package $package_id + set root_folder_id [::$package_id folder_id] + + lang::system::set_locale en_US + set f_id [::xowiki::test::require_folder \ + "childresources-folder" $root_folder_id $package_id] + + # + # Create sample pages for testing + # + foreach {title} { + a + A + b + c + Bor + Bar + Bär + bb + -bb + zz + } { + set id($title) [xowiki::test::require_form_page \ + -title $title \ + en:p$title $f_id $package_id] + } + ::xo::db::CrClass get_instance_from_db -item_id $id(a) + + foreach includelet { + {child-resources -parent .. -columns {name title} -orderby title,asc} + } { + aa_section "$includelet" + + set HTML [$id(a) include $includelet] + #ns_log notice "RRR $includelet => $HTML " + + acs::test::dom_html root $HTML { + set elements [lmap node [$root selectNodes {//tr/td[2]}] {lindex [$node asText] 0}] + } + aa_log "elements: $elements" + + # + # Run these test only when "ns_strcoll" is available + # + if {![::acs::icanuse "ns_strcoll"]} { + continue + } + + aa_true "find Bar" {[lsearch $elements Bar] > -1} + aa_true "find Bär" {[lsearch $elements Bär] > -1} + aa_true "find Bor" {[lsearch $elements Bor] > -1} + + aa_true "Bar before Bär" {[lsearch $elements Bar] < [lsearch $elements Bär]} + aa_true "Bar before Bor" {[lsearch $elements Bar] < [lsearch $elements Bor]} + aa_true "Bar before Bär" {[lsearch $elements Bar] < [lsearch $elements Bär]} + aa_true "Bär before Bor" {[lsearch $elements Bär] < [lsearch $elements Bor]} + } + + } finally { + lang::system::set_locale $system_locale + + # set node_id [site_node::get_node_id -url /$instance] + # site_node::unmount -node_id $node_id + # site_node::delete -node_id $node_id -delete_package + } + }