Skip to content

Commit

Permalink
Fix some issues after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
tfussell committed Jul 23, 2018
1 parent 0af7ad8 commit cbe50f4
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 144 deletions.
13 changes: 1 addition & 12 deletions source/detail/implementations/workbook_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct workbook_impl
{
return active_sheet_index_ == other.active_sheet_index_
&& worksheets_ == other.worksheets_
&& shared_strings_ == other.shared_strings_
&& shared_strings_ids_ == other.shared_strings_ids_
&& stylesheet_ == other.stylesheet_
&& base_date_ == other.base_date_
&& title_ == other.title_
Expand Down Expand Up @@ -138,7 +138,6 @@ struct workbook_impl
optional<workbook_view> view_;
optional<std::string> code_name_;

<<<<<<< Updated upstream
struct file_version_t
{
std::string app_name;
Expand All @@ -154,17 +153,7 @@ struct workbook_impl
&& rup_build == rhs.rup_build;
}
};

=======
struct file_version_t
{
std::string app_name;
std::size_t last_edited;
std::size_t lowest_edited;
std::size_t rup_build;
};

>>>>>>> Stashed changes
optional<file_version_t> file_version_;
optional<calculation_properties> calculation_properties_;
optional<std::string> abs_path_;
Expand Down
11 changes: 0 additions & 11 deletions source/detail/serialization/xlsx_consumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,7 @@ cell xlsx_consumer::read_cell()

if (parser().attribute_present("s"))
{
<<<<<<< Updated upstream
cell.format(target_.format(static_cast<std::size_t>(std::stoull(parser().attribute("s")))));
=======
cell.format(target_.format(std::stoull(parser().attribute("s"))));
>>>>>>> Stashed changes
}

auto has_value = false;
Expand Down Expand Up @@ -540,15 +536,12 @@ std::string xlsx_consumer::read_worksheet_begin(const std::string &rel_id)
current_selection.active_cell(parser().attribute("activeCell"));
}

<<<<<<< Updated upstream
if (parser().attribute_present("sqref"))
{
const auto sqref = range_reference(parser().attribute("sqref"));
current_selection.sqref(sqref);
}

=======
>>>>>>> Stashed changes
current_selection.pane(pane_corner::top_left);

new_view.add_selection(current_selection);
Expand Down Expand Up @@ -734,11 +727,7 @@ void xlsx_consumer::read_worksheet_sheetdata()

if (parser().attribute_present("s"))
{
<<<<<<< Updated upstream
cell.format(target_.format(static_cast<std::size_t>(std::stoull(parser().attribute("s")))));
=======
cell.format(target_.format(std::stoull(parser().attribute("s"))));
>>>>>>> Stashed changes
}

auto has_value = false;
Expand Down
4 changes: 0 additions & 4 deletions source/workbook/workbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,11 @@ workbook workbook::empty()
.color(theme_color(1));
stylesheet.fonts.push_back(default_font);

<<<<<<< Updated upstream
wb.create_builtin_style(0)
.border(default_border)
.fill(default_fill)
.font(default_font)
.number_format(xlnt::number_format::general());
=======
wb.create_builtin_style(0);
>>>>>>> Stashed changes

wb.create_format(true)
.border(default_border)
Expand Down
3 changes: 1 addition & 2 deletions tests/styles/style_test_suite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class style_test_suite : public test_suite
void test_all()
{
xlnt::workbook wb;
auto ws = wb.active_sheet();
auto test_style = wb.create_style("test_style");
test_style.number_format(xlnt::number_format::date_ddmmyyyy());

Expand All @@ -63,4 +62,4 @@ class style_test_suite : public test_suite
xlnt_assert(copy_style.quote_prefix());
}
};
static style_test_suite x;
static style_test_suite x;
115 changes: 0 additions & 115 deletions tests/workbook/serialization_test_suite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ class serialization_test_suite : public test_suite
const auto path = path_helper::test_file("3_default.xlsx");
xlnt_assert(workbook_matches_file(wb, path));
}
<<<<<<< Updated upstream:tests/workbook/serialization_test_suite.cpp

void test_produce_simple_excel()
{
Expand Down Expand Up @@ -246,103 +245,6 @@ class serialization_test_suite : public test_suite

sheet1.cell("A5").hyperlink("https://google.com/");
sheet1.cell("A5").format(hyperlink_format);
=======

void test_produce_simple_excel()
{
xlnt::workbook wb;
auto ws = wb.active_sheet();

auto bold_font = xlnt::font().bold(true);

ws.cell("A1").value("Type");
ws.cell("A1").font(bold_font);

ws.cell("B1").value("Value");
ws.cell("B1").font(bold_font);

ws.cell("A2").value("null");
ws.cell("B2").value(nullptr);

ws.cell("A3").value("bool (true)");
ws.cell("B3").value(true);

ws.cell("A4").value("bool (false)");
ws.cell("B4").value(false);

ws.cell("A5").value("number (int)");
ws.cell("B5").value(std::numeric_limits<int>::max());

ws.cell("A5").value("number (unsigned int)");
ws.cell("B5").value(std::numeric_limits<unsigned int>::max());

ws.cell("A6").value("number (long long int)");
ws.cell("B6").value(std::numeric_limits<long long int>::max());

ws.cell("A6").value("number (unsigned long long int)");
ws.cell("B6").value(std::numeric_limits<unsigned long long int>::max());

ws.cell("A13").value("number (float)");
ws.cell("B13").value(std::numeric_limits<float>::max());

ws.cell("A14").value("number (double)");
ws.cell("B14").value(std::numeric_limits<double>::max());

ws.cell("A16").value("text (char *)");
ws.cell("B16").value("string");

ws.cell("A17").value("text (std::string)");
ws.cell("B17").value(std::string("string"));

ws.cell("A18").value("date");
ws.cell("B18").value(xlnt::date(2016, 2, 3));

ws.cell("A19").value("time");
ws.cell("B19").value(xlnt::time(1, 2, 3, 4));

ws.cell("A20").value("datetime");
ws.cell("B20").value(xlnt::datetime(2016, 2, 3, 1, 2, 3, 4));

ws.cell("A21").value("timedelta");
ws.cell("B21").value(xlnt::timedelta(1, 2, 3, 4, 5));

ws.freeze_panes("B2");

std::vector<std::uint8_t> temp_buffer;
wb.save(temp_buffer);
xlnt_assert(!temp_buffer.empty());
}

void test_save_after_sheet_deletion()
{
xlnt::workbook workbook;

xlnt_assert_equals(workbook.sheet_titles().size(), 1);

auto sheet = workbook.create_sheet();
sheet.title("XXX1");
xlnt_assert_equals(workbook.sheet_titles().size(), 2);

workbook.remove_sheet(workbook.sheet_by_title("XXX1"));
xlnt_assert_equals(workbook.sheet_titles().size(), 1);

std::vector<std::uint8_t> temp_buffer;
xlnt_assert_throws_nothing(workbook.save(temp_buffer));
xlnt_assert(!temp_buffer.empty());
}

void test_write_comments_hyperlinks_formulae()
{
xlnt::workbook wb;
auto sheet1 = wb.active_sheet();
auto comment_font = xlnt::font().bold(true).size(10).color(xlnt::indexed_color(81)).name("Calibri");

sheet1.cell("A1").value("Sheet1!A1");
sheet1.cell("A1").comment("Sheet1 comment", comment_font, "Microsoft Office User");

sheet1.cell("A2").value("Sheet1!A2");
sheet1.cell("A2").comment("Sheet1 comment2", comment_font, "Microsoft Office User");
>>>>>>> Stashed changes:tests/workbook/serialization_test_suite.hpp

sheet1.cell("A6").hyperlink(sheet1.cell("A1"));
sheet1.cell("A6").format(hyperlink_format);
Expand All @@ -355,7 +257,6 @@ class serialization_test_suite : public test_suite
sheet1.cell("C2").value("a");
sheet1.cell("C3").value("b");

<<<<<<< Updated upstream:tests/workbook/serialization_test_suite.cpp
for (auto i = 1; i <= 7; ++i)
{
sheet1.row_properties(i).dy_descent = 0.2;
Expand All @@ -369,11 +270,6 @@ class serialization_test_suite : public test_suite
// comments
sheet2.cell("A1").value("Sheet2!A1");
sheet2.cell("A1").comment("Sheet2 comment", comment_font, "Microsoft Office User");
=======
auto sheet2 = wb.create_sheet();
sheet2.cell("A1").value("Sheet2!A1");
sheet2.cell("A2").comment("Sheet2 comment", comment_font, "Microsoft Office User");
>>>>>>> Stashed changes:tests/workbook/serialization_test_suite.hpp

sheet2.cell("A2").value("Sheet2!A2");
sheet2.cell("A2").comment("Sheet2 comment2", comment_font, "Microsoft Office User");
Expand Down Expand Up @@ -464,17 +360,11 @@ class serialization_test_suite : public test_suite
{
#ifdef _MSC_VER
xlnt::workbook wb;
<<<<<<< Updated upstream:tests/workbook/serialization_test_suite.cpp
// L"/9_unicode_Λ.xlsx" doesn't use wchar_t(0x039B) for the capital lambda...
// L"/9_unicode_\u039B.xlsx" gives the corrct output
const auto path = LSTRING_LITERAL(XLNT_TEST_DATA_DIR) L"/9_unicode_\u039B.xlsx"; // L"/9_unicode_Λ.xlsx"
wb.load(path);
xlnt_assert_equals(wb.active_sheet().cell("A1").value<std::string>(), u8"un\u00EFc\u00F4d\u0117!"); // u8"unïcôdė!"
=======
std::wstring path = LSTRING_LITERAL(XLNT_TEST_DATA_DIR) L"/9_unicode_Λ.xlsx";
wb.load(path_normalized);
xlnt_assert_equals(wb.active_sheet().cell("A1").value<std::string>(), u8"unicodê!");
>>>>>>> Stashed changes:tests/workbook/serialization_test_suite.hpp
#endif

#ifndef __MINGW32__
Expand Down Expand Up @@ -670,13 +560,8 @@ class serialization_test_suite : public test_suite
ws.column_properties("E").width = width;
ws.column_properties("E").custom_width = true;

<<<<<<< Updated upstream:tests/workbook/serialization_test_suite.cpp
xlnt_assert(workbook_matches_file(wb,
path_helper::test_file("13_custom_heights_widths.xlsx")));
=======
wb.save("temp.xlsx");
xlnt_assert(workbook_matches_file(wb, path_helper::test_file("13_custom_heights_widths.xlsx")));
>>>>>>> Stashed changes:tests/workbook/serialization_test_suite.hpp
}

/// <summary>
Expand Down

0 comments on commit cbe50f4

Please sign in to comment.