Sha256: b38539dfa47b533f5b52ad5defc8eb36c3a8fd759cf7b07653874f45902e7554

Contents?: true

Size: 905 Bytes

Versions: 1

Compression:

Stored size: 905 Bytes

Contents

# frozen_string_literal: true

require_relative './xlsx_func_testcase'

class TestProtect < XlsxWriterTestCase
  test 'protect02' do |wb, t|
    t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
    wb.add_format :unlocked, unlocked: true
    wb.add_format :hidden, unlocked: true, hidden: true
    wb.add_worksheet do |ws|
      ws.protect
      ws.write_number(0, 'A', 1, nil)
      ws.write_number(1, 'A', 2, :unlocked)
      ws.write_number(2, 'A', 3, :hidden)
    end
  end

  test 'protect03' do |wb, t|
    t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
    wb.add_format :unlocked, unlocked: true
    wb.add_format :hidden, unlocked: true, hidden: true
    wb.add_worksheet do |ws|
      ws.protect 'password'
      ws.write_number(0, 'A', 1, nil)
      ws.write_number(1, 'A', 2, :unlocked)
      ws.write_number(2, 'A', 3, :hidden)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xlsxwriter-0.2.2 test/test_protect.rb