format: fix identation and alignment property mismatch

Fix issue where a horizontal alignment format was ignored if the
indentation was also set.
This commit is contained in:
John McNamara 2024-02-03 23:42:54 +00:00
parent d3c1443155
commit b0c76b3396
4 changed files with 48 additions and 5 deletions

View file

@ -0,0 +1,37 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2024, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = workbook_new("test_format24.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_format *format1 = workbook_add_format(workbook);
/*
'rotation': 270,
'indent': 1,
'align': "center",
'valign': "top"
*/
format_set_rotation(format1, 270);
format_set_indent(format1, 1);
format_set_align(format1, LXW_ALIGN_CENTER);
format_set_align(format1, LXW_ALIGN_VERTICAL_TOP);
worksheet_set_row(worksheet, 0, 75, NULL);
worksheet_write_string(worksheet, 0, 0, "ABCD", format1);
return workbook_close(workbook);
}

View file

@ -49,6 +49,9 @@ class TestCompareXLSXFiles(base_test_class.XLSXBaseTest):
def test_format18(self):
self.run_exe_test('test_format18')
def test_format24(self):
self.run_exe_test('test_format24')
def test_format50(self):
self.run_exe_test('test_format50')

Binary file not shown.