Branch Coverage

blib/lib/Excel/Writer/XLSX/Workbook.pm
Criterion Covered Total %
branch 277 330 83.9


line true false branch
107 0 892 if (exists $options->{'tempdir'})
111 0 892 if (exists $options->{'date_1904'})
115 0 892 if (exists $options->{'optimization'})
119 1 891 if (exists $options->{'default_format_properties'})
124 8 884 if (exists $options->{'excel2003_style'})
128 1 891 if (exists $options->{'max_url_length'})
131 0 1 if ($self->{'_max_url_length'} < 255)
151 8 884 if ($self->{'_excel2003_style'}) { }
162 0 892 if (not ref $self->{'_filename'} and $self->{'_filename'} eq "")
169 55 837 if (ref $self->{'_filename'}) { }
0 837 elsif ($self->{'_filename'} eq '-') { }
184 0 837 unless defined $fh
259 0 892 if $self->{'_fileclosed'}
262 0 892 unless defined $self->{'_filehandle'}
268 837 55 if ($self->{'_internal_fh'}) { }
290 53 839 if not $self->{'_fileclosed'}
306 0 11 if (@_) { }
330 1 3 unless defined $sheetname
419 0 437 unless (defined $type)
427 20 417 unless ($embedded)
454 20 417 if (not $embedded) { }
474 5 412 if $arg{'name'}
504 20 1033 if ($chart) { }
512 990 63 if ($name eq "")
514 20 970 if ($chart) { }
523 1 1052 if length $name > 31
526 6 1046 if ($name =~ /$invalid_char/)
531 3 1043 if ($name =~ /^'/ or $name =~ /'$/)
541 2 498 if (lc $name_a eq lc $name_b)
564 19 2025 if ($self->{'_excel2003_style'})
612 0 1 if (defined $_[0]) { }
647 3 2 if (defined $_[1] and $_[1] =~ /^#(\w\w)(\w\w)(\w\w)/)
660 0 5 if ($index < 8 or $index > 64)
666 0 5 if ($red < 0 or $red > 255 or ($green < 0 or $green > 255) or ($blue < 0 or $blue > 255))
771 0 1 if defined $dir and not -d $dir
798 9 30 if ($name =~ /^(.*)!(.*)$/) { }
808 0 39 unless (defined $sheet_index)
814 4 35 if (not $name =~ /^[\w\\][\w\\.]*$/ or $name =~ /^\d/)
820 4 31 if ($name =~ /^[a-zA-Z][a-zA-Z]?[a-dA-D]?[0-9]+$/)
826 6 25 if ($name =~ /^[rcRC]$/ or $name =~ /^[rcRC]\d+[rcRC]\d+$/)
847 2 3 if (not $width) { }
855 2 3 if (not $height) { }
876 1 3 unless (defined $tab_ratio)
880 0 3 if ($tab_ratio < 0 or $tab_ratio > 100) { }
902 0 2 unless @_
922 0 10 unless (exists $valid{$parameter})
929 2 0 unless (exists $param{'created'})
961 0 18 unless (defined $name and defined $value)
969 7 11 unless ($type)
970 1 6 if ($value =~ /^\d+$/) { }
2 4 elsif ($value =~ /^([+-]?)(?=[0-9]|\.[0-9])[0-9]*(\.[0-9]*)?([Ee]([+-]?[0-9]+))?$/) { }
984 0 18 unless (exists $valid_type{$type})
990 0 18 if ($type eq "text" and length $value > 255)
995 0 18 if (length $value > 255)
1017 0 6 unless $vba_project
1020 0 6 unless -e $vba_project
1023 6 0 unless ($self->{'_vba_codemame'})
1042 2 2 if ($vba_codemame) { }
1079 1 2 if ($mode eq 'manual') { }
1 1 elsif ($mode eq 'auto_except_tables') { }
1087 1 2 if defined $calc_id
1123 46 846 unless @{$self->{'_worksheets'};}
1126 883 9 if ($self->{'_activesheet'} == 0)
1133 890 151 if $sheet->{'_index'} == $self->{'_activesheet'}
1137 6 886 if ($self->{'_vba_project'})
1139 3 3 unless ($sheet->{'_vba_codename'})
1179 10903 8428 if -f $_
1226 837 55 if ($self->{'_internal_fh'}) { }
1228 0 837 if ($zip->writeToFileHandle($self->{'_filehandle'}) != 0)
1241 0 55 if ($zip->writeToFileHandle($tmp_fh, $is_seekable) != 0)
1324 1173 914 if (defined $xf_index)
1328 33 2054 if (defined $dxf_index)
1371 130 1043 if (exists $fonts{$key}) { }
1394 2 22 if ($format->{'_color'} or $format->{'_bold'} or $format->{'_italic'} or $format->{'_underline'} or $format->{'_font_strikeout'})
1431 34 1172 if ($num_format =~ /^\d+$/ and not $num_format =~ /^0+\d/) { }
1149 23 elsif ($num_format eq 'General') { }
1434 1 33 if ($num_format == 0)
1449 3 20 if (exists $num_formats{$num_format}) { }
1462 18 2 if ($format->{'_xf_index'})
1489 224 949 if (exists $borders{$key}) { }
1511 1 32 if ($key =~ /[^0:]/)
1543 14 16 if ($format->{'_pattern'} or $format->{'_bg_color'} or $format->{'_fg_color'})
1564 3 6 if ($format->{'_pattern'} == 1 and $format->{'_bg_color'} ne 0 and $format->{'_fg_color'} ne 0)
1573 6 1160 if ($format->{'_pattern'} <= 1 and $format->{'_bg_color'} ne 0 and $format->{'_fg_color'} eq 0)
1582 13 1153 if ($format->{'_pattern'} <= 1 and $format->{'_bg_color'} eq 0 and $format->{'_fg_color'} ne 0)
1593 1155 18 if (exists $fills{$key}) { }
1632 11 1033 if ($sheet->{'_autofilter'})
1644 8 1036 if ($sheet->{'_print_area'})
1654 7 1037 if ($sheet->{'_repeat_cols'} or $sheet->{'_repeat_rows'})
1657 2 5 if ($sheet->{'_repeat_cols'} and $sheet->{'_repeat_rows'}) { }
1694 0 105 unless _normalise_defined_name($Excel::Writer::XLSX::Workbook::a->[0]) cmp _normalise_defined_name($Excel::Writer::XLSX::Workbook::b->[0])
1753 12 64 if $name eq "_xlnm._FilterDatabase"
1756 57 7 if ($range =~ /^([^!]+)!/)
1760 18 39 if ($name =~ /^_xlnm\.(.*)$/) { }
16 23 elsif ($index != -1) { }
1806 494 5 unless ($chart_count or $image_count or $shape_count or $header_image_count or $footer_image_count or $has_background)
1817 107 24 if ($chart_count or $image_count or $shape_count)
1823 8 539 if ($has_background)
1830 1 7 if (exists $background_ids{$md5}) { }
1850 12 114 if (exists $image_ids{$md5}) { }
1885 4 30 if (exists $header_image_ids{$md5}) { }
1909 8 4 if (exists $header_image_ids{$md5}) { }
1925 523 24 if ($has_drawing)
1936 426 11 if ($chart->{'_id'} != -1)
1969 961 22 unless $sheet->{'_has_vml'} or $sheet->{'_has_header_vml'}
1973 58 22 if ($sheet->{'_has_vml'})
1975 44 14 if ($sheet->{'_has_comments'})
1993 24 56 if ($sheet->{'_has_header_vml'})
2024 1013 28 unless $table_count
2044 1 1040 if ($sheet->{'_has_dynamic_arrays'})
2074 10 416 if ($chart->{'_combined'})
2087 16 1187 if (defined $chart->{'_formula_data'}[$id])
2088 16 0 unless (exists $seen_ranges{$range} and defined $seen_ranges{$range})
2098 20 1167 if (exists $seen_ranges{$range})
2107 0 1167 unless defined $sheetname
2111 0 1167 if ($sheetname =~ /^\([^,]+,/)
2119 0 1167 unless (exists $worksheets{$sheetname})
2132 28 5497 if (ref $token)
2136 0 28 if ($token =~ /^<r>/ and $token =~ m[</r>$])
2170 1173 1 if ($pos > 0) { }
2179 1142 31 if ($cells =~ /:/) { }
2195 1 1172 if ($row_start != $row_end and $col_start != $col_end)
2243 0 0 if ($sheetname =~ /^Sheet\d+$/) { }
2277 0 180 unless defined $fh
2285 97 83 if (unpack('x A3', $data) eq 'PNG') { }
80 3 elsif (unpack('n', $data) == 65496) { }
2 1 elsif (unpack('A4', $data) eq 'GIF8') { }
1 0 elsif (unpack('A2', $data) eq 'BM') { }
2321 1 179 if $x_dpi == 0
2322 1 179 if $y_dpi == 0
2358 97 474 if ($type eq "IHDR")
2363 11 560 if ($type eq "pHYs")
2368 11 0 if ($units == 1)
2376 97 474 if $type eq "IEND"
2379 0 97 unless (defined $height)
2404 0 1 if (length $data <= 54)
2412 0 1 if ($width > 65535)
2416 0 1 if ($height > 65535)
2423 0 1 if ($bitcount != 24)
2427 0 1 if ($planes != 1)
2435 0 1 if ($compression != 0)
2471 80 296 if (($marker & 65520) == 65472 and $marker != 65476 and $marker != 65484)
2480 79 672 if ($marker == 65504)
2485 67 12 if ($units == 1)
2490 0 79 if ($units == 2)
2497 80 671 if $marker == 65498
2500 0 80 unless (defined $height)
2528 0 2 unless (defined $height)
2551 9 0 if (exists $self->{'_sheetnames'}{$sheetname}) { }
2569 0 10 defined $_[0] ? :
2571 0 10 if $self->sheets
2639 6 890 if ($self->{'_vba_project'})
2657 894 1 unless $self->{'_read_only'}
2681 6 890 if $codename
2682 1 895 if $date_1904
2729 6 902 if $tab_ratio != 600
2732 3 905 if $first_sheet > 0
2735 11 897 if $active_tab > 0
2781 3 1047 if $hidden
2803 2 897 if ($self->{'_calc_mode'} eq 'manual') { }
2 895 elsif ($self->{'_calc_mode'} eq 'autoNoTable') { }
2811 897 2 if ($self->{'_calc_on_load'})
2885 867 30 unless @{$self->{'_defined_names'};}
2915 43 20 if $id != -1
2916 11 52 if $hidden