layout} $result]
+ # do not add
inside
+ set text "text begin\r\n\nline1\nline2\n
text\nend\n"
+ aa_log "Input: [ns_quotehtml $text]
"
+ set result [util_convert_line_breaks_to_html -contains_pre $text]
+ aa_log "result is [ns_quotehtml $result]
"
+ set nrBr [regsub -all
$result
.]
+ aa_true "text contains some [ns_quotehtml
] tags" {$nrBr > 0}
+
+ if {[::acs::icanuse "ns_parsehtml"]} {
+ aa_true "text contains $nrBr [ns_quotehtml
] tags" {$nrBr == 2}
+ }
+
+
}
@@ -550,6 +569,45 @@
}
aa_register_case \
+ -cats {api smoke} \
+ -procs {
+ ad_text_to_html
+ util_convert_line_breaks_to_html
+ } \
+ ad_text_to_html {
+ Test rendering of a more or less standard HTML text
+} {
+ set text {We could use a instead than a
layout » for the list for example.»}
+ set result [ad_text_to_html -no_quote -includes_html -- $text]
+ aa_log "Input:\n[ns_quotehtml $text]"
+ aa_log "Result:\n[ns_quotehtml $result]"
+ if {[::acs::icanuse "ns_parsehtml"]} {
+ aa_true "text contains sample code" [string match ** $result]
+ }
+ aa_true "gullimet » preserved" [string match *»* $result]
+
+ #
+ # This calls util_convert_line_breaks_to_html as well, but
+ # strangely when this is called with -includes_html" it removes
+ # newlines around although "pre" is not included in the
+ # regular expression.
+ #
+ set text "text begin\n\nline1\nline2\n
text\nend\n"
+ aa_log "Input: [ns_quotehtml $text]
"
+ set result [ad_text_to_html -includes_html -no_quote $text]
+ aa_log "result is [ns_quotehtml $result]
"
+ set nrBr [regsub -all
$result
.]
+ aa_true "text contains [ns_quotehtml
] tags" {$nrBr > 0}
+
+ if {[::acs::icanuse "ns_parsehtml"]} {
+ aa_true "text contains $nrBr [ns_quotehtml
] tags" {$nrBr == 1}
+ }
+ #aa_equals "new: $html _version should be the same" $html_version $string_with_img
+
+}
+
+
+aa_register_case \
-cats {api} \
-bugs 1450 \
-procs {ad_enhanced_text_to_html} \
@@ -559,11 +617,12 @@
@author Nima Mazloumi
} {
- set string_with_img {}
- aa_log "Original string is $string_with_img"
- set html_version [ad_enhanced_text_to_html $string_with_img]
- aa_equals "new: $html_version should be the same" $html_version $string_with_img
-}
+ set text_with_pre "text\n\nline1\nline2\n
text end\n"
+ aa_log "Original string is [ns_quotehtml $text_with_pre]"
+ set html [ad_enhanced_text_to_html $text_with_pre]
+ aa_log "result is [ns_quotehtml $html]"
+ #aa_equals "new: $html _version should be the same" $html_version $string_with_img
+ }
aa_register_case \
-cats {api smoke} \
Index: openacs-4/packages/acs-tcl/tcl/test/object-test-case-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/object-test-case-procs.tcl,v
diff -u -r1.9.2.9 -r1.9.2.10
--- openacs-4/packages/acs-tcl/tcl/test/object-test-case-procs.tcl 8 Aug 2022 14:48:48 -0000 1.9.2.9
+++ openacs-4/packages/acs-tcl/tcl/test/object-test-case-procs.tcl 29 Aug 2022 10:34:19 -0000 1.9.2.10
@@ -204,11 +204,11 @@
[acs_object::is_type_p -object_id $object_id -object_type person]
aa_true "Is $object_id a party?" \
[acs_object::is_type_p -object_id $object_id -object_type party]
- aa_true "Is $object_id a user (no hierachy)?" \
+ aa_true "Is $object_id a user (no hierarchy)?" \
[acs_object::is_type_p -object_id $object_id -object_type user -no_hierarchy]
- aa_false "Is $object_id a person (no hierachy)?" \
+ aa_false "Is $object_id a person (no hierarchy)?" \
[acs_object::is_type_p -object_id $object_id -object_type person -no_hierarchy]
- aa_false "Is $object_id a party (no hierachy)?" \
+ aa_false "Is $object_id a party (no hierarchy)?" \
[acs_object::is_type_p -object_id $object_id -object_type party -no_hierarchy]
aa_true "Is $object_id a user os a package?" \
@@ -217,13 +217,13 @@
[acs_object::is_type_p -object_id $object_id -object_type {apm_package person}]
aa_true "Is $object_id a party or a package?" \
[acs_object::is_type_p -object_id $object_id -object_type {apm_package party}]
- aa_true "Is $object_id a user or a package (no hierachy)?" \
+ aa_true "Is $object_id a user or a package (no hierarchy)?" \
[acs_object::is_type_p -object_id $object_id -object_type {apm_package user} -no_hierarchy]
- aa_false "Is $object_id a person or a package (no hierachy)?" \
+ aa_false "Is $object_id a person or a package (no hierarchy)?" \
[acs_object::is_type_p -object_id $object_id \
-object_type {apm_package person} \
-no_hierarchy]
- aa_false "Is $object_id a party or a package (no hierachy)?" \
+ aa_false "Is $object_id a party or a package (no hierarchy)?" \
[acs_object::is_type_p -object_id $object_id \
-object_type {apm_package party} -no_hierarchy]