From fb9aa9eae11acb54796a57d820a38dc1bedfef34 2021-01-29 16:28:18 From: Brett Smith Date: 2021-01-29 16:28:18 Subject: [PATCH] tests: Add tests for BaseODS.bgcolor_style(). --- diff --git a/tests/test_reports_spreadsheet.py b/tests/test_reports_spreadsheet.py index 7359d3a12e116094bc22ad0ea93a670a3f81b33a..c80b17035b4f03c86d09ece2d0287851d0d494ec 100644 --- a/tests/test_reports_spreadsheet.py +++ b/tests/test_reports_spreadsheet.py @@ -308,6 +308,16 @@ def test_ods_writer_style(ods_writer, attr_name, child_type, checked_attr): child = get_child(actual, child_type) assert child.getAttribute(checked_attr) +@pytest.mark.parametrize('hexcolor', ['#0000ff', '#66cc99']) +def test_ods_writer_bgcolor_style(ods_writer, hexcolor): + style = ods_writer.bgcolor_style(hexcolor) + props, = style.childNodes + assert props.getAttribute('backgroundcolor') == hexcolor + +def test_ods_writer_bgcolor_style_caches(ods_writer): + style1 = ods_writer.bgcolor_style('#008800') + assert ods_writer.bgcolor_style('#008800') is style1 + @pytest.mark.parametrize('edges,width,style,color', [ (core.Border.TOP, '5px', 'solid', '#ff0000'),