mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
fix bug
This commit is contained in:
parent
026058d111
commit
36b676048f
|
@ -89,8 +89,9 @@ public:
|
|||
{
|
||||
xlnt::workbook wb, wb2;
|
||||
auto new_sheet = wb.create_sheet(0);
|
||||
new_sheet.set_title("removed");
|
||||
wb.remove_sheet(new_sheet);
|
||||
TS_ASSERT(std::find(wb.begin(), wb.end(), new_sheet) == wb.end());
|
||||
TS_ASSERT_EQUALS(wb.get_sheet_by_name("removed"), nullptr);
|
||||
TS_ASSERT_THROWS(wb.remove_sheet(wb2.get_active_sheet()), std::runtime_error);
|
||||
}
|
||||
|
||||
|
|
|
@ -316,8 +316,8 @@ worksheet workbook::create_sheet(std::size_t index)
|
|||
|
||||
if (index != d_->worksheets_.size() - 1)
|
||||
{
|
||||
std::swap(d_->worksheets_.back(), d_->worksheets_[index]);
|
||||
d_->worksheets_.pop_back();
|
||||
d_->worksheets_.insert(d_->worksheets_.begin() + index, d_->worksheets_.back());
|
||||
d_->worksheets_.pop_back();
|
||||
}
|
||||
|
||||
return worksheet(&d_->worksheets_[index]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user