mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
test inlinestr
This commit is contained in:
parent
ffeb1b1046
commit
ce0ae608ee
|
@ -839,4 +839,10 @@ public:
|
|||
{
|
||||
format_and_test(xlnt::number_format::date_dmminus(), {{"13-5", "###########", "0-1", "text"}});
|
||||
}
|
||||
|
||||
// m-yy
|
||||
void test_builtin_format_date_myminus()
|
||||
{
|
||||
format_and_test(xlnt::number_format::date_myminus(), {{"5-16", "###########", "1-00", "text"}});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -14,7 +14,25 @@ public:
|
|||
existing_file = path_helper::get_data_directory("/genuine/empty.xlsx");
|
||||
expected_content_types_string = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default Extension=\"xml\" ContentType=\"application/xml\"/><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/><Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/worksheets/sheet2.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/worksheets/sheet3.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/worksheets/sheet4.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/theme/theme1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.theme+xml\"/><Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/><Override PartName=\"/xl/sharedStrings.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml\"/><Override PartName=\"/xl/calcChain.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml\"/><Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\"/><Override PartName=\"/docProps/app.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\"/></Types>";
|
||||
expected_atxt_string = "<?xml version=\"1.0\" ?>\n<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"3\" uniqueCount=\"2\"><si><t>This is cell A1 in Sheet 1</t></si><si><t>This is cell G5</t></si></sst>";
|
||||
expected_printdir_string = " Length Date Time Name\n--------- ---------- ----- ----\n 1704 01/01/1980 00:00 [Content_Types].xml\n 588 01/01/1980 00:00 _rels/.rels\n 1254 01/01/1980 00:00 xl/_rels/workbook.xml.rels\n 898 01/01/1980 00:00 xl/workbook.xml\n 1231 01/01/1980 00:00 xl/worksheets/sheet4.xml\n 4427 01/01/1980 00:00 xl/worksheets/sheet2.xml\n 1032 01/01/1980 00:00 xl/worksheets/sheet3.xml\n 1026 01/01/1980 00:00 xl/worksheets/sheet1.xml\n 6995 01/01/1980 00:00 xl/theme/theme1.xml\n 233 01/01/1980 00:00 xl/sharedStrings.xml\n 1724 01/01/1980 00:00 xl/styles.xml\n 169 01/01/1980 00:00 xl/calcChain.xml\n 917 01/01/1980 00:00 docProps/app.xml\n 609 01/01/1980 00:00 docProps/core.xml\n--------- -------\n 22807 14 files\n";
|
||||
expected_printdir_string =
|
||||
" Length Date Time Name\n"
|
||||
"--------- ---------- ----- ----\n"
|
||||
" 1704 01/01/1980 00:00 [Content_Types].xml\n"
|
||||
" 588 01/01/1980 00:00 _rels/.rels\n"
|
||||
" 917 01/01/1980 00:00 docProps/app.xml\n"
|
||||
" 609 01/01/1980 00:00 docProps/core.xml\n"
|
||||
" 1254 01/01/1980 00:00 xl/_rels/workbook.xml.rels\n"
|
||||
" 169 01/01/1980 00:00 xl/calcChain.xml\n"
|
||||
" 233 01/01/1980 00:00 xl/sharedStrings.xml\n"
|
||||
" 1724 01/01/1980 00:00 xl/styles.xml\n"
|
||||
" 6995 01/01/1980 00:00 xl/theme/theme1.xml\n"
|
||||
" 898 01/01/1980 00:00 xl/workbook.xml\n"
|
||||
" 1068 07/21/2016 20:27 xl/worksheets/sheet1.xml\n"
|
||||
" 4427 01/01/1980 00:00 xl/worksheets/sheet2.xml\n"
|
||||
" 1032 01/01/1980 00:00 xl/worksheets/sheet3.xml\n"
|
||||
" 1231 01/01/1980 00:00 xl/worksheets/sheet4.xml\n"
|
||||
"--------- -------\n"
|
||||
" 22849 14 files\n";
|
||||
}
|
||||
|
||||
void remove_temp_file()
|
||||
|
@ -142,13 +160,13 @@ public:
|
|||
void test_infolist()
|
||||
{
|
||||
xlnt::zip_file f(existing_file);
|
||||
TS_ASSERT(f.infolist().size() == 14);
|
||||
TS_ASSERT_EQUALS(f.infolist().size(), 14);
|
||||
}
|
||||
|
||||
void test_namelist()
|
||||
{
|
||||
xlnt::zip_file f(existing_file);
|
||||
TS_ASSERT(f.namelist().size() == 14);
|
||||
TS_ASSERT_EQUALS(f.namelist().size(), 14);
|
||||
}
|
||||
|
||||
void test_open_by_name()
|
||||
|
@ -205,7 +223,7 @@ public:
|
|||
std::stringstream ss;
|
||||
f.printdir(ss);
|
||||
auto printed = ss.str();
|
||||
TS_ASSERT(printed == expected_printdir_string);
|
||||
TS_ASSERT_EQUALS(printed, expected_printdir_string);
|
||||
}
|
||||
|
||||
void test_read()
|
||||
|
|
|
@ -554,4 +554,11 @@ public:
|
|||
|
||||
TS_ASSERT_THROWS(xlnt::shared_strings_serializer::read_shared_strings(xml_bad, strings), std::runtime_error);
|
||||
}
|
||||
|
||||
void test_read_inlinestr()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load(path_helper::get_data_directory("/genuine/empty.xlsx"));
|
||||
TS_ASSERT_EQUALS(wb.get_sheet_by_index(0).get_cell("A1").get_value<std::string>(), "This is cell A1 in Sheet 1");
|
||||
}
|
||||
};
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user