Branch Coverage

blib/lib/Excel/Writer/XLSX/Workbook.pm
Criterion Covered Total %
branch 266 318 83.6


line true false branch
105 0 849 if (exists $options->{'tempdir'})
109 0 849 if (exists $options->{'date_1904'})
113 0 849 if (exists $options->{'optimization'})
117 1 848 if (exists $options->{'default_format_properties'})
122 8 841 if (exists $options->{'excel2003_style'})
126 1 848 if (exists $options->{'max_url_length'})
129 0 1 if ($self->{'_max_url_length'} < 255)
149 8 841 if ($self->{'_excel2003_style'}) { }
160 0 849 if (not ref $self->{'_filename'} and $self->{'_filename'} eq '')
167 55 794 if (ref $self->{'_filename'}) { }
0 794 elsif ($self->{'_filename'} eq '-') { }
182 0 794 unless defined $fh
254 0 849 if $self->{'_fileclosed'}
257 0 849 unless defined $self->{'_filehandle'}
263 794 55 if ($self->{'_internal_fh'}) { }
285 53 796 if not $self->{'_fileclosed'}
301 0 11 if (@_) { }
325 1 3 unless defined $sheetname
414 0 429 unless (defined $type)
422 20 409 unless ($embedded)
449 20 409 if (not $embedded) { }
469 5 404 if $arg{'name'}
499 20 988 if ($chart) { }
507 945 63 if ($name eq '')
509 20 925 if ($chart) { }
518 1 1007 if length $name > 31
521 6 1001 if ($name =~ /$invalid_char/)
526 3 998 if ($name =~ /^'/ or $name =~ /'$/)
536 2 496 if (lc $name_a eq lc $name_b)
559 19 1929 if ($self->{'_excel2003_style'})
607 0 1 if (defined $_[0]) { }
642 3 2 if (defined $_[1] and $_[1] =~ /^#(\w\w)(\w\w)(\w\w)/)
655 0 5 if ($index < 8 or $index > 64)
661 0 5 if ($red < 0 or $red > 255 or ($green < 0 or $green > 255) or ($blue < 0 or $blue > 255))
766 0 1 if defined $dir and not -d $dir
793 9 30 if ($name =~ /^(.*)!(.*)$/) { }
803 0 39 unless (defined $sheet_index)
809 4 35 if (not $name =~ /^[\w\\][\w\\.]*$/ or $name =~ /^\d/)
815 4 31 if ($name =~ /^[a-zA-Z][a-zA-Z]?[a-dA-D]?[0-9]+$/)
821 6 25 if ($name =~ /^[rcRC]$/ or $name =~ /^[rcRC]\d+[rcRC]\d+$/)
842 2 3 if (not $width) { }
850 2 3 if (not $height) { }
871 1 3 unless (defined $tab_ratio)
875 0 3 if ($tab_ratio < 0 or $tab_ratio > 100) { }
897 0 2 unless @_
917 0 10 unless (exists $valid{$parameter})
924 2 0 unless (exists $param{'created'})
956 0 18 unless (defined $name and defined $value)
964 7 11 unless ($type)
965 1 6 if ($value =~ /^\d+$/) { }
2 4 elsif ($value =~ /^([+-]?)(?=[0-9]|\.[0-9])[0-9]*(\.[0-9]*)?([Ee]([+-]?[0-9]+))?$/) { }
979 0 18 unless (exists $valid_type{$type})
985 0 18 if ($type eq 'text' and length $value > 255)
990 0 18 if (length $value > 255)
1012 0 6 unless $vba_project
1015 0 6 unless -e $vba_project
1018 6 0 unless ($self->{'_vba_codemame'})
1037 2 2 if ($vba_codemame) { }
1060 1 2 if ($mode eq 'manual') { }
1 1 elsif ($mode eq 'auto_except_tables') { }
1068 1 2 if defined $calc_id
1103 46 803 unless @{$self->{'_worksheets'};}
1106 840 9 if ($self->{'_activesheet'} == 0)
1113 847 149 if $sheet->{'_index'} == $self->{'_activesheet'}
1117 6 843 if ($self->{'_vba_project'})
1119 3 3 unless ($sheet->{'_vba_codename'})
1156 10400 8039 if -f $_
1203 794 55 if ($self->{'_internal_fh'}) { }
1205 0 794 if ($zip->writeToFileHandle($self->{'_filehandle'}) != 0)
1218 0 55 if ($zip->writeToFileHandle($tmp_fh, $is_seekable) != 0)
1301 1120 871 if (defined $xf_index)
1305 33 1958 if (defined $dxf_index)
1348 122 998 if (exists $fonts{$key}) { }
1371 2 22 if ($format->{'_color'} or $format->{'_bold'} or $format->{'_italic'} or $format->{'_underline'} or $format->{'_font_strikeout'})
1408 34 1119 if ($num_format =~ /^\d+$/ and not $num_format =~ /^0+\d/) { }
1096 23 elsif ($num_format eq 'General') { }
1411 1 33 if ($num_format == 0)
1426 3 20 if (exists $num_formats{$num_format}) { }
1439 18 2 if ($format->{'_xf_index'})
1466 214 906 if (exists $borders{$key}) { }
1488 1 32 if ($key =~ /[^0:]/)
1520 14 16 if ($format->{'_pattern'} or $format->{'_bg_color'} or $format->{'_fg_color'})
1541 3 6 if ($format->{'_pattern'} == 1 and $format->{'_bg_color'} ne '0' and $format->{'_fg_color'} ne '0')
1550 6 1109 if ($format->{'_pattern'} <= 1 and $format->{'_bg_color'} ne '0' and $format->{'_fg_color'} eq '0')
1559 13 1102 if ($format->{'_pattern'} <= 1 and $format->{'_bg_color'} eq '0' and $format->{'_fg_color'} ne '0')
1570 1104 16 if (exists $fills{$key}) { }
1609 11 988 if ($sheet->{'_autofilter'})
1621 8 991 if ($sheet->{'_print_area'})
1631 7 992 if ($sheet->{'_repeat_cols'} or $sheet->{'_repeat_rows'})
1634 2 5 if ($sheet->{'_repeat_cols'} and $sheet->{'_repeat_rows'}) { }
1671 0 105 unless _normalise_defined_name($Excel::Writer::XLSX::Workbook::a->[0]) cmp _normalise_defined_name($Excel::Writer::XLSX::Workbook::b->[0])
1730 12 64 if $name eq '_xlnm._FilterDatabase'
1733 57 7 if ($range =~ /^([^!]+)!/)
1737 18 39 if ($name =~ /^_xlnm\.(.*)$/) { }
16 23 elsif ($index != -1) { }
1781 474 1 unless ($chart_count or $image_count or $shape_count or $header_image_count or $footer_image_count)
1791 95 19 if ($chart_count or $image_count or $shape_count)
1804 12 102 if (exists $image_ids{$md5}) { }
1839 4 28 if (exists $header_image_ids{$md5}) { }
1863 8 4 if (exists $header_image_ids{$md5}) { }
1879 503 19 if ($has_drawing)
1890 418 11 if ($chart->{'_id'} != -1)
1923 918 21 unless $sheet->{'_has_vml'} or $sheet->{'_has_header_vml'}
1927 57 21 if ($sheet->{'_has_vml'})
1929 43 14 if ($sheet->{'_has_comments'})
1947 22 56 if ($sheet->{'_has_header_vml'})
1978 969 27 unless $table_count
2010 10 408 if ($chart->{'_combined'})
2023 16 1160 if (defined $chart->{'_formula_data'}[$id])
2024 16 0 unless (exists $seen_ranges{$range} and defined $seen_ranges{$range})
2034 20 1140 if (exists $seen_ranges{$range})
2043 0 1140 unless defined $sheetname
2047 0 1140 if ($sheetname =~ /^\([^,]+,/)
2055 0 1140 unless (exists $worksheets{$sheetname})
2068 27 5375 if (ref $token)
2072 0 27 if ($token =~ /^/ and $token =~ m[$])
2106 1146 1 if ($pos > 0) { }
2115 1118 28 if ($cells =~ /:/) { }
2131 1 1145 if ($row_start != $row_end and $col_start != $col_end)
2179 0 0 if ($sheetname =~ /^Sheet\d+$/) { }
2213 0 158 unless defined $fh
2222 91 67 if (unpack('x A3', $data) eq 'PNG') { }
66 1 elsif (unpack('n', $data) == 65496) { }
1 0 elsif (unpack('A2', $data) eq 'BM') { }
2250 1 157 if $x_dpi == 0
2251 1 157 if $y_dpi == 0
2287 91 444 if ($type eq 'IHDR')
2292 11 524 if ($type eq 'pHYs')
2297 11 0 if ($units == 1)
2305 91 444 if $type eq 'IEND'
2308 0 91 unless (defined $height)
2333 0 1 if (length $data <= 54)
2341 0 1 if ($width > 65535)
2345 0 1 if ($height > 65535)
2352 0 1 if ($bitcount != 24)
2356 0 1 if ($planes != 1)
2364 0 1 if ($compression != 0)
2400 66 240 if (($marker & 65520) == 65472 and $marker != 65476 and $marker != 65484)
2409 65 557 if ($marker == 65504)
2414 64 1 if ($units == 1)
2419 0 65 if ($units == 2)
2426 66 556 if $marker == 65498
2429 0 66 unless (defined $height)
2452 9 0 if (exists $self->{'_sheetnames'}{$sheetname}) { }
2470 0 10 defined $_[0] ? :
2472 0 10 if $self->sheets
2540 6 847 if ($self->{'_vba_project'})
2564 6 847 if $codename
2565 1 852 if $date_1904
2612 6 859 if $tab_ratio != 600
2615 3 862 if $first_sheet > 0
2618 11 854 if $active_tab > 0
2664 3 1002 if $hidden
2686 2 854 if ($self->{'_calc_mode'} eq 'manual') { }
2 852 elsif ($self->{'_calc_mode'} eq 'autoNoTable') { }
2694 854 2 if ($self->{'_calc_on_load'})
2768 824 30 unless @{$self->{'_defined_names'};}
2798 43 20 if $id != -1
2799 11 52 if $hidden