xlnt/tests/test_strings.hpp

61 lines
1.7 KiB
C++
Raw Normal View History

2014-05-09 03:32:12 +08:00
#pragma once
#include <iostream>
#include <cxxtest/TestSuite.h>
2014-06-06 04:19:31 +08:00
#include <xlnt/xlnt.hpp>
2014-05-09 03:32:12 +08:00
2014-06-06 04:19:31 +08:00
class test_strings : public CxxTest::TestSuite
2014-05-09 03:32:12 +08:00
{
public:
2014-06-06 04:19:31 +08:00
test_strings()
2014-05-09 03:32:12 +08:00
{
}
void test_create_string_table()
{
/*wb = Workbook()
2014-05-13 01:42:28 +08:00
ws = wb.create_sheet()
ws.cell("B12").value = "hello"
ws.cell("B13").value = "world"
ws.cell("D28").value = "hello"
table = create_string_table(wb)
TS_ASSERT_EQUALS({"hello": 1, "world" : 0}, table)*/
2014-05-09 03:32:12 +08:00
}
void test_read_string_table()
{
/*handle = open(os.path.join(DATADIR, "reader", "sharedStrings.xml"))
2014-05-13 01:42:28 +08:00
try :
content = handle.read()
string_table = read_string_table(content)
TS_ASSERT_EQUALS({0: "This is cell A1 in Sheet 1", 1 : "This is cell G5"}, string_table)
finally :
handle.close()*/
2014-05-09 03:32:12 +08:00
}
void test_empty_string()
{
/*handle = open(os.path.join(DATADIR, "reader", "sharedStrings-emptystring.xml"))
2014-05-13 01:42:28 +08:00
try :
content = handle.read()
string_table = read_string_table(content)
TS_ASSERT_EQUALS({0: "Testing empty cell", 1 : ""}, string_table)
finally :
handle.close()*/
2014-05-09 03:32:12 +08:00
}
void test_formatted_string_table()
{
/*handle = open(os.path.join(DATADIR, "reader", "shared-strings-rich.xml"))
2014-05-13 01:42:28 +08:00
try :
content = handle.read()
string_table = read_string_table(content)
TS_ASSERT_EQUALS({0: "Welcome", 1 : "to the best shop in town",
2 : " let"s play "}, string_table)
finally :
handle.close()*/
2014-05-09 03:32:12 +08:00
}
};