mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
test opening bad files
This commit is contained in:
parent
b10b2a2bd3
commit
d1d9471e15
|
@ -553,4 +553,15 @@ public:
|
||||||
wb.load(path_helper::get_data_directory("/genuine/empty.xlsx"));
|
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");
|
TS_ASSERT_EQUALS(wb.get_sheet_by_index(0).get_cell("A1").get_value<std::string>(), "This is cell A1 in Sheet 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_determine_document_type()
|
||||||
|
{
|
||||||
|
xlnt::workbook wb;
|
||||||
|
TS_ASSERT_THROWS(wb.load(path_helper::get_data_directory("1_empty.txt")), xlnt::invalid_file_error);
|
||||||
|
TS_ASSERT_THROWS(wb.load(path_helper::get_data_directory("2_not-empty.txt")), xlnt::invalid_file_error);
|
||||||
|
TS_ASSERT_THROWS(wb.load(path_helper::get_data_directory("3_empty.zip")), xlnt::invalid_file_error);
|
||||||
|
TS_ASSERT_THROWS(wb.load(path_helper::get_data_directory("4_not-package.zip")), xlnt::invalid_file_error);
|
||||||
|
TS_ASSERT_THROWS(wb.load(path_helper::get_data_directory("5_document.docx")), xlnt::invalid_file_error);
|
||||||
|
TS_ASSERT_THROWS(wb.load(path_helper::get_data_directory("6_presentation.pptx")), xlnt::invalid_file_error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1168,8 +1168,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const_range = ws_const.get_range("B3:C7");
|
const auto const_range = ws_const.get_range("B3:C7");
|
||||||
auto const_range_iter = const_range.begin();
|
auto const_range_iter = const_range.cbegin();
|
||||||
const_range_iter++;
|
const_range_iter++;
|
||||||
const_range_iter--;
|
const_range_iter--;
|
||||||
TS_ASSERT_EQUALS(const_range_iter, const_range.begin());
|
TS_ASSERT_EQUALS(const_range_iter, const_range.begin());
|
||||||
|
|
0
tests/data/1_empty.txt
Normal file
0
tests/data/1_empty.txt
Normal file
1
tests/data/2_not-empty.txt
Normal file
1
tests/data/2_not-empty.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
not-empty
|
BIN
tests/data/3_empty.zip
Normal file
BIN
tests/data/3_empty.zip
Normal file
Binary file not shown.
BIN
tests/data/4_not-package.zip
Normal file
BIN
tests/data/4_not-package.zip
Normal file
Binary file not shown.
BIN
tests/data/5_document.docx
Normal file
BIN
tests/data/5_document.docx
Normal file
Binary file not shown.
BIN
tests/data/6_presentation.pptx
Normal file
BIN
tests/data/6_presentation.pptx
Normal file
Binary file not shown.
BIN
tests/data/7_excel-empty.xlsx
Normal file
BIN
tests/data/7_excel-empty.xlsx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user