aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/test/resources/conversion/matrix.vhtml
diff options
context:
space:
mode:
Diffstat (limited to 'velocity-engine-core/src/test/resources/conversion/matrix.vhtml')
-rw-r--r--velocity-engine-core/src/test/resources/conversion/matrix.vhtml85
1 files changed, 85 insertions, 0 deletions
diff --git a/velocity-engine-core/src/test/resources/conversion/matrix.vhtml b/velocity-engine-core/src/test/resources/conversion/matrix.vhtml
new file mode 100644
index 00000000..ee7ae5b7
--- /dev/null
+++ b/velocity-engine-core/src/test/resources/conversion/matrix.vhtml
@@ -0,0 +1,85 @@
+<!doctype html>
+
+#macro(print,$type)
+ #set($string = "$type")
+ #if($string.startsWith("class java.lang.") || $string.startsWith("class java.math."))
+ #set($string = $string.substring(16))
+ #end
+$string##
+#end
+
+#macro(cell,$type)<span class="$type">$type</span>#end
+
+#macro(check,$row,$col)
+ #if($introspect.isStrictlyConvertible($row, $col)) #cell('strict')
+ #elseif($introspect.isImplicitlyConvertible($row, $col)) #cell('implicit')
+ #elseif($introspect.isExplicitlyConvertible($row, $col)) #cell('explicit')
+ #else #cell('none')
+ #end
+#end
+
+<html>
+ <head>
+ <style type="text/css">
+ table
+ {
+ border: solid 1px black;
+ border-collapse: collapse;
+ }
+ td, th
+ {
+ border: solid 1px black;
+ }
+ .strict
+ {
+ color: green;
+ }
+ .implicit
+ {
+ color: blue;
+ }
+ .explicit
+ {
+ color: magenta;
+ }
+ .none
+ {
+ color: red;
+ }
+
+ </style>
+ </head>
+ <body>
+ <table>
+ <thead>
+ <tr>
+ <th>
+ provided &rarr;<br/>
+ expected &darr;
+ </th>
+#foreach($col in $types)
+ <th>#print($col)</th>
+#end
+ <th>null</th>
+ </tr>
+#foreach($row in $types)
+ <tr>
+ <th>#print($row)</th>
+ #foreach($col in $types)
+ <td>#check($row,$col)</td>
+ #end
+ #if($row.isPrimitive())
+ <td>#cell('none')</td>
+ #else
+ <td>#check($row, $null)</td>
+ #end
+ </tr>
+#end
+ </thead>
+ <tbody>
+ </tbody>
+ </table>
+ </body>
+</html>
+
+