Excel-Writer-XLSX

 view release on metacpan or  search on metacpan

t/chart/sub_write_legend.t  view on Meta::CPAN

$expected = '<c:legend><c:legendPos val="l"/><c:layout/></c:legend>';

$chart = _new_object( \$got, 'Excel::Writer::XLSX::Chart' );

$chart->set_legend( position => 'left' );
$chart->_write_legend();

is( $got, $expected, $caption );


###############################################################################
#
# Test the _write_legend() method.
#
$caption  = " \tChart: _write_legend()";
$expected = '<c:legend><c:legendPos val="b"/><c:layout/></c:legend>';

$chart = _new_object( \$got, 'Excel::Writer::XLSX::Chart' );

$chart->set_legend( position => 'bottom' );
$chart->_write_legend();

is( $got, $expected, $caption );


###############################################################################
#
# Test the _write_legend() method.
#
$caption  = " \tChart: _write_legend()";
$expected = '';

$chart = _new_object( \$got, 'Excel::Writer::XLSX::Chart' );

$chart->set_legend( position => 'none' );
$chart->_write_legend();

is( $got, $expected, $caption );


###############################################################################
#
# Test the _write_legend() method.
#
$caption  = " \tChart: _write_legend()";
$expected = '';

$chart = _new_object( \$got, 'Excel::Writer::XLSX::Chart' );

$chart->set_legend( position => 'some_non_existing_value' );
$chart->_write_legend();

is( $got, $expected, $caption );


###############################################################################
#
# Test the _write_legend() method.
#
$caption  = " \tChart: _write_legend()";
$expected = '<c:legend><c:legendPos val="r"/><c:layout/><c:overlay val="1"/></c:legend>';

$chart = _new_object( \$got, 'Excel::Writer::XLSX::Chart' );

$chart->set_legend( position => 'overlay_right' );
$chart->_write_legend();

is( $got, $expected, $caption );


###############################################################################
#
# Test the _write_legend() method.
#
$caption  = " \tChart: _write_legend()";
$expected = '<c:legend><c:legendPos val="l"/><c:layout/><c:overlay val="1"/></c:legend>';

$chart = _new_object( \$got, 'Excel::Writer::XLSX::Chart' );

$chart->set_legend( position => 'overlay_left' );
$chart->_write_legend();

is( $got, $expected, $caption );


###############################################################################
#
# Test the _write_legend() method.
#
$caption  = " \tChart: _write_legend()";
$expected = '<c:legend><c:legendPos val="tr"/><c:layout/></c:legend>';

$chart = _new_object( \$got, 'Excel::Writer::XLSX::Chart' );

$chart->set_legend( position => 'top_right' );
$chart->_write_legend();

is( $got, $expected, $caption );


###############################################################################
#
# Test the _write_legend() method.
#
$caption  = " \tChart: _write_legend()";
$expected = '<c:legend><c:legendPos val="tr"/><c:layout/><c:overlay val="1"/></c:legend>';

$chart = _new_object( \$got, 'Excel::Writer::XLSX::Chart' );

$chart->set_legend( position => 'overlay_top_right' );
$chart->_write_legend();

is( $got, $expected, $caption );

__END__



( run in 0.390 second using v1.01-cache-2.11-cpan-39bf76dae61 )