Branch Coverage

blib/lib/Excel/Writer/XLSX/Workbook.pm
Criterion Covered Total %
branch 272 324 83.9


line true false branch
104 0 809 if (exists $options->{'tempdir'})
108 0 809 if (exists $options->{'date_1904'})
112 0 809 if (exists $options->{'optimization'})
116 1 808 if (exists $options->{'default_format_properties'})
121 8 801 if (exists $options->{'excel2003_style'})
125 1 808 if (exists $options->{'max_url_length'})
128 0 1 if ($self->{'_max_url_length'} < 255)
148 8 801 if ($self->{'_excel2003_style'}) { }
159 0 809 if (not ref $self->{'_filename'} and $self->{'_filename'} eq '')
166 55 754 if (ref $self->{'_filename'}) { }
0 754 elsif ($self->{'_filename'} eq '-') { }
181 0 754 unless defined $fh
253 0 809 if $self->{'_fileclosed'}
256 0 809 unless defined $self->{'_filehandle'}
262 754 55 if ($self->{'_internal_fh'}) { }
284 53 756 if not $self->{'_fileclosed'}
300 0 9 if (@_) { }
324 1 3 unless defined $sheetname
413 0 405 unless (defined $type)
421 20 385 unless ($embedded)
448 20 385 if (not $embedded) { }
468 5 380 if $arg{'name'}
498 20 952 if ($chart) { }
506 906 66 if ($name eq '')
508 20 886 if ($chart) { }
517 1 971 if length $name > 31
520 6 965 if ($name =~ /$invalid_char/)
525 3 962 if ($name =~ /^'/ or $name =~ /'$/)
530 4 958 if (lc $name eq 'history')
540 2 496 if (lc $name_a eq lc $name_b)
563 19 1848 if ($self->{'_excel2003_style'})
611 0 1 if (defined $_[0]) { }
646 3 2 if (defined $_[1] and $_[1] =~ /^#(\w\w)(\w\w)(\w\w)/)
659 0 5 if ($index < 8 or $index > 64)
665 0 5 if ($red < 0 or $red > 255 or ($green < 0 or $green > 255) or ($blue < 0 or $blue > 255))
770 0 1 if defined $dir and not -d $dir
797 9 30 if ($name =~ /^(.*)!(.*)$/) { }
807 0 39 unless (defined $sheet_index)
813 4 35 if (not $name =~ /^[\w\\][\w\\.]*$/ or $name =~ /^\d/)
819 4 31 if ($name =~ /^[a-zA-Z][a-zA-Z]?[a-dA-D]?[0-9]+$/)
825 6 25 if ($name =~ /^[rcRC]$/ or $name =~ /^[rcRC]\d+[rcRC]\d+$/)
846 2 3 if (not $width) { }
854 2 3 if (not $height) { }
875 1 3 unless (defined $tab_ratio)
879 0 3 if ($tab_ratio < 0 or $tab_ratio > 100) { }
901 0 2 unless @_
921 0 10 unless (exists $valid{$parameter})
928 2 0 unless (exists $param{'created'})
960 0 18 unless (defined $name and defined $value)
968 7 11 unless ($type)
969 1 6 if ($value =~ /^\d+$/) { }
2 4 elsif ($value =~ /^([+-]?)(?=[0-9]|\.[0-9])[0-9]*(\.[0-9]*)?([Ee]([+-]?[0-9]+))?$/) { }
983 0 18 unless (exists $valid_type{$type})
989 0 18 if ($type eq 'text' and length $value > 255)
994 0 18 if (length $value > 255)
1016 0 5 unless $vba_project
1019 0 5 unless -e $vba_project
1022 5 0 unless ($self->{'_vba_codemame'})
1041 2 2 if ($vba_codemame) { }
1064 1 2 if ($mode eq 'manual') { }
1 1 elsif ($mode eq 'auto_except_tables') { }
1072 1 2 if defined $calc_id
1107 46 763 unless @{$self->{'_worksheets'};}
1110 800 9 if ($self->{'_activesheet'} == 0)
1117 807 149 if $sheet->{'_index'} == $self->{'_activesheet'}
1121 5 804 if ($self->{'_vba_project'})
1123 2 3 unless ($sheet->{'_vba_codename'})
1160 9888 7615 if -f $_
1207 754 55 if ($self->{'_internal_fh'}) { }
1209 0 754 if ($zip->writeToFileHandle($self->{'_filehandle'}) != 0)
1222 0 55 if ($zip->writeToFileHandle($tmp_fh, $is_seekable) != 0)
1305 1111 831 if (defined $xf_index)
1309 33 1909 if (defined $dxf_index)
1352 122 989 if (exists $fonts{$key}) { }
1375 2 22 if ($format->{'_color'} or $format->{'_bold'} or $format->{'_italic'} or $format->{'_underline'} or $format->{'_font_strikeout'})
1412 34 1110 if ($num_format =~ /^\d+$/ and not $num_format =~ /^0+\d/) { }
1087 23 elsif ($num_format eq 'General') { }
1415 1 33 if ($num_format == 0)
1430 3 20 if (exists $num_formats{$num_format}) { }
1443 18 2 if ($format->{'_xf_index'})
1470 245 866 if (exists $borders{$key}) { }
1492 1 32 if ($key =~ /[^0:]/)
1524 14 16 if ($format->{'_pattern'} or $format->{'_bg_color'} or $format->{'_fg_color'})
1545 3 6 if ($format->{'_pattern'} == 1 and $format->{'_bg_color'} ne '0' and $format->{'_fg_color'} ne '0')
1554 6 1100 if ($format->{'_pattern'} <= 1 and $format->{'_bg_color'} ne '0' and $format->{'_fg_color'} eq '0')
1563 13 1093 if ($format->{'_pattern'} <= 1 and $format->{'_bg_color'} eq '0' and $format->{'_fg_color'} ne '0')
1574 1095 16 if (exists $fills{$key}) { }
1613 11 948 if ($sheet->{'_autofilter'})
1625 8 951 if ($sheet->{'_print_area'})
1635 7 952 if ($sheet->{'_repeat_cols'} or $sheet->{'_repeat_rows'})
1638 2 5 if ($sheet->{'_repeat_cols'} and $sheet->{'_repeat_rows'}) { }
1675 0 105 unless _normalise_defined_name($Excel::Writer::XLSX::Workbook::a->[0]) cmp _normalise_defined_name($Excel::Writer::XLSX::Workbook::b->[0])
1734 12 64 if $name eq '_xlnm._FilterDatabase'
1737 57 7 if ($range =~ /^([^!]+)!/)
1741 18 39 if ($name =~ /^_xlnm\.(.*)$/) { }
16 23 elsif ($index != -1) { }
1785 468 1 unless ($chart_count or $image_count or $shape_count or $header_image_count or $footer_image_count)
1795 85 19 if ($chart_count or $image_count or $shape_count)
1808 11 92 if (exists $image_ids{$md5}) { }
1843 4 28 if (exists $header_image_ids{$md5}) { }
1867 8 4 if (exists $header_image_ids{$md5}) { }
1883 469 19 if ($has_drawing)
1894 394 11 if ($chart->{'_id'} != -1)
1927 882 21 unless $sheet->{'_has_vml'} or $sheet->{'_has_header_vml'}
1931 53 21 if ($sheet->{'_has_vml'})
1933 39 14 if $sheet->{'_has_comments'}
1934 39 14 if $sheet->{'_has_comments'}
1947 22 52 if ($sheet->{'_has_header_vml'})
1960 32 777 if ($comment_files > 0)
1993 929 27 unless $table_count
2025 10 384 if ($chart->{'_combined'})
2038 16 1082 if (defined $chart->{'_formula_data'}[$id])
2039 16 0 unless (exists $seen_ranges{$range} and defined $seen_ranges{$range})
2049 20 1062 if (exists $seen_ranges{$range})
2058 0 1062 unless defined $sheetname
2062 0 1062 if ($sheetname =~ /^\([^,]+,/)
2070 0 1062 unless (exists $worksheets{$sheetname})
2083 25 5019 if (ref $token)
2087 0 25 if ($token =~ /^/ and $token =~ m[$])
2121 1068 1 if ($pos > 0) { }
2130 1048 20 if ($cells =~ /:/) { }
2146 1 1067 if ($row_start != $row_end and $col_start != $col_end)
2194 0 0 if ($sheetname =~ /^Sheet\d+$/) { }
2228 0 147 unless defined $fh
2237 80 67 if (unpack('x A3', $data) eq 'PNG') { }
66 1 elsif (unpack('n', $data) == 65496) { }
1 0 elsif (unpack('A2', $data) eq 'BM') { }
2265 1 146 if $x_dpi == 0
2266 1 146 if $y_dpi == 0
2302 80 389 if ($type eq 'IHDR')
2307 11 458 if ($type eq 'pHYs')
2312 11 0 if ($units == 1)
2320 80 389 if $type eq 'IEND'
2323 0 80 unless (defined $height)
2348 0 1 if (length $data <= 54)
2356 0 1 if ($width > 65535)
2360 0 1 if ($height > 65535)
2367 0 1 if ($bitcount != 24)
2371 0 1 if ($planes != 1)
2379 0 1 if ($compression != 0)
2415 66 240 if (($marker & 65520) == 65472 and $marker != 65476 and $marker != 65484)
2424 65 557 if ($marker == 65504)
2429 64 1 if ($units == 1)
2434 0 65 if ($units == 2)
2441 66 556 if $marker == 65498
2444 0 66 unless (defined $height)
2467 9 0 if (exists $self->{'_sheetnames'}{$sheetname}) { }
2485 0 8 defined $_[0] ? :
2487 0 8 if $self->sheets
2555 5 808 if ($self->{'_vba_project'})
2579 5 808 if $codename
2580 1 812 if $date_1904
2627 6 819 if $tab_ratio != 600
2630 3 822 if $first_sheet > 0
2633 11 814 if $active_tab > 0
2679 3 962 if $hidden
2701 2 814 if ($self->{'_calc_mode'} eq 'manual') { }
2 812 elsif ($self->{'_calc_mode'} eq 'autoNoTable') { }
2709 814 2 if ($self->{'_calc_on_load'})
2783 784 30 unless @{$self->{'_defined_names'};}
2813 43 20 if $id != -1
2814 11 52 if $hidden