summaryrefslogtreecommitdiffhomepage
path: root/test/tc_package.rb
diff options
context:
space:
mode:
authorWeston Ganger <[email protected]>2022-10-12 23:02:49 -0700
committerWeston Ganger <[email protected]>2022-10-12 23:10:08 -0700
commit28d59a1dba55a9d98ceed26ac3bed6267cf18481 (patch)
tree5b05b8926dd301f7bf0e714df848a5a209653348 /test/tc_package.rb
parent56f0977033d87c29fbcb5a20f0bd61d8fe3fb1ec (diff)
downloadcaxlsx-28d59a1dba55a9d98ceed26ac3bed6267cf18481.tar.gz
caxlsx-28d59a1dba55a9d98ceed26ac3bed6267cf18481.zip
Resolve all TODOs
Diffstat (limited to 'test/tc_package.rb')
-rw-r--r--test/tc_package.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/tc_package.rb b/test/tc_package.rb
index 79fe20f5..0788d029 100644
--- a/test/tc_package.rb
+++ b/test/tc_package.rb
@@ -157,6 +157,26 @@ class TestPackage < Test::Unit::TestCase
end
end
+ def test_serialize_automatically_performs_apply_styles
+ p = Axlsx::Package.new
+ wb = p.workbook
+
+ assert_nil wb.styles_applied
+ wb.add_worksheet do |sheet|
+ sheet.add_row ['A1', 'B1']
+ sheet.add_style 'A1:B1', b: true
+ end
+
+ @fname = 'axlsx_test_serialization.xlsx'
+
+ p.serialize(@fname)
+
+ assert_equal true, wb.styles_applied
+ assert_equal 1, wb.styles.style_index.count
+
+ File.delete(@fname)
+ end
+
def assert_zip_file_matches_package(fname, package)
zf = Zip::File.open(fname)
package.send(:parts).each{ |part| zf.get_entry(part[:entry]) }
@@ -305,6 +325,21 @@ class TestPackage < Test::Unit::TestCase
assert(Axlsx::Relationship.ids_cache.empty?)
end
+ def test_to_stream_automatically_performs_apply_styles
+ p = Axlsx::Package.new
+ wb = p.workbook
+
+ assert_nil wb.styles_applied
+ wb.add_worksheet do |sheet|
+ sheet.add_row ['A1', 'B1']
+ sheet.add_style 'A1:B1', b: true
+ end
+
+ p.to_stream
+
+ assert_equal 1, wb.styles.style_index.count
+ end
+
def test_encrypt
# this is no where near close to ready yet
assert(@package.encrypt('your_mom.xlsxl', 'has a password') == false)