diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-07-18 17:16:39 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-07-18 17:16:39 -0400 |
commit | 1b404926df08ac4bbe6cbd2c7ada14de6cebda63 (patch) | |
tree | 0781c32efbc33403aa7580b170057ad1a2719b0f /t/data | |
parent | b73fe4b205e7a2b521ea3dd84024b21f0f10cd7f (diff) | |
download | spreadsheet-template-1b404926df08ac4bbe6cbd2c7ada14de6cebda63.tar.gz spreadsheet-template-1b404926df08ac4bbe6cbd2c7ada14de6cebda63.zip |
add some tests
Diffstat (limited to 't/data')
-rw-r--r-- | t/data/Test.json | 151 | ||||
-rw-r--r-- | t/data/Test.xlsx | bin | 0 -> 35554 bytes | |||
-rw-r--r-- | t/data/template.json | 50 |
3 files changed, 201 insertions, 0 deletions
diff --git a/t/data/Test.json b/t/data/Test.json new file mode 100644 index 0000000..64fc6e1 --- /dev/null +++ b/t/data/Test.json @@ -0,0 +1,151 @@ +{ + "selection" : 0, + "worksheets" : [ + { + "cells" : [ + [ + { + "contents" : "Colored Cell", + "format" : { + "bg_color" : "#9BBB59", + "color" : "#FFFF00", + "pattern" : "solid", + "size" : 12 + }, + "type" : "string" + }, + { + "contents" : "Wide Cell (25.00)", + "type" : "string" + }, + { + "contents" : "Bordered Cell w/ Text Wrap", + "format" : { + "border" : [ + "thin", + "thin", + "thin", + "thin" + ], + "border_color" : [ + "#000000", + "#000000", + "#000000", + "#000000" + ], + "text_wrap" : true + }, + "type" : "string" + }, + { + "contents" : "Middle Valigned", + "format" : { + "valign" : "vcenter" + }, + "type" : "string" + }, + { + "contents" : "Right Aligned and text wrapped", + "format" : { + "align" : "right", + "text_wrap" : true + }, + "type" : "string" + } + ], + [ + {}, + {}, + {}, + {}, + {} + ], + [ + { + "contents" : 10, + "type" : "number" + }, + {}, + {}, + {}, + {} + ], + [ + { + "contents" : 20, + "type" : "number" + }, + {}, + {}, + { + "contents" : 2.5, + "format" : { + "num_format" : "\"$\"#,##0.00" + }, + "type" : "number" + }, + { + "contents" : "<< currency cell", + "format" : { + "align" : "center", + "color" : "#4BACC6", + "size" : 12 + }, + "type" : "string" + } + ], + [ + { + "contents" : 30, + "type" : "number" + }, + {}, + {}, + {}, + {} + ], + [ + { + "contents" : 60, + "formula" : "SUM(A3:A5)", + "type" : "number" + }, + { + "contents" : "<< formula cell", + "format" : { + "align" : "right", + "bg_color" : "#EEECE1", + "color" : "#F79646", + "pattern" : "solid", + "size" : 12 + }, + "type" : "string" + }, + {}, + {}, + {} + ] + ], + "column_widths" : [ + 10.83203125, + 25.83203125, + 10, + 15, + 18.1640625 + ], + "name" : "Sheet1", + "row_heights" : [ + 45, + 15, + 15, + 15, + 15, + 15 + ], + "selection" : [ + 3, + 4 + ] + } + ] +} diff --git a/t/data/Test.xlsx b/t/data/Test.xlsx Binary files differnew file mode 100644 index 0000000..7c1f8ad --- /dev/null +++ b/t/data/Test.xlsx diff --git a/t/data/template.json b/t/data/template.json new file mode 100644 index 0000000..a57b33e --- /dev/null +++ b/t/data/template.json @@ -0,0 +1,50 @@ +%% my $default = { color => '#000000', size => 14 }; +%% format(normal => $default.merge({})); +%% format(date => $default.merge({ num_format => 'd-mmm' })); +%% format(money => $default.merge({ num_format => '$#,##0.00_);[Red]($#,##0.00)' })); +%% format(title => $default.merge({ bg_color => '#c6d9f0', pattern => 'solid' })); +%% format(bold => $default.merge({ bold => true() })); +%% format(bold_money => $default.merge({ bold => true(), num_format => '$#,##0.00_);[Red]($#,##0.00)' })); +{ + "selection" : 0, + "worksheets" : [ + { + "column_widths" : [ 14.6, 18.5, 15.8, 12.2 ], + "name" : "Report 1", + "selection" : [ 1, 9 ], + "row_heights" : [ 25, 18, 18, 18 ], + "cells" : [ + [ + [% c("Descriptions", "title") %], + [% c("Numbers", "title") %], + [% c("Dates", "title") %], + [% c("Money", "title") %] + ], + %% for $rows -> $row { + [ + [% c($row.description, "normal") %], + [% c($row.number, "normal", "number") %], + [% c($row.date, "date", "date_time") %], + [% c($row.money, "money", "number") %] + ], + %% } + [ + [% c("Totals:", "bold") %], + [% c( + $rows.map(-> $a { $a.number }).reduce(-> $a, $b { $a + $b }), + "bold", + "number", + formula => 'SUM(B2:B' ~ ($rows.size() + 1) ~ ')', + ) %], + [% c("", "bold") %], + [% c( + $rows.map(-> $a { $a.money }).reduce(-> $a, $b { $a + $b }), + "bold_money", + "number", + formula => 'SUM(D2:D' ~ ($rows.size() + 1) ~ ')', + ) %] + ] + ] + } + ] +} |