mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix GncOptionMultichoiceValue list tests
To conform to changes in 84eb084375.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "gnc-option-impl.hpp"
|
||||
#include "gnc-datetime.hpp"
|
||||
#include "gnc-option-uitype.hpp"
|
||||
#include "guid.hpp"
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
@@ -887,11 +888,15 @@ GncOptionAccountSelValue::deserialize(const std::string& str) noexcept
|
||||
std::string
|
||||
GncOptionMultichoiceValue::serialize() const noexcept
|
||||
{
|
||||
static const std::string no_value{"No Value"};
|
||||
static const std::string no_value{""};
|
||||
std::string retval;
|
||||
bool first = true;
|
||||
bool list_context = m_ui_type == GncOptionUIType::LIST;
|
||||
if (m_value.empty())
|
||||
return no_value;
|
||||
|
||||
if (list_context)
|
||||
retval += '(';
|
||||
for (auto index : m_value)
|
||||
{
|
||||
if (!first)
|
||||
@@ -899,6 +904,8 @@ GncOptionMultichoiceValue::serialize() const noexcept
|
||||
first = false;
|
||||
retval += std::get<0>(m_choices[index]);
|
||||
}
|
||||
if (list_context)
|
||||
retval += ')';
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -846,12 +846,11 @@ TEST_F(GncListOption, test_set_value)
|
||||
TEST_F(GncListOption, test_list_out)
|
||||
{
|
||||
auto vec{m_option.get_value<GncMultichoiceOptionIndexVec>()};
|
||||
std::string value{m_option.permissible_value(vec[0])};
|
||||
value += " ";
|
||||
value += m_option.permissible_value(vec[1]);
|
||||
std::ostringstream oss;
|
||||
std::ostringstream vss, oss;
|
||||
vss << '(' << m_option.permissible_value(vec[0]) << " "
|
||||
<< m_option.permissible_value(vec[1]) << ')';
|
||||
oss << m_option;
|
||||
EXPECT_EQ(oss.str(), value);
|
||||
EXPECT_EQ(oss.str(), vss.str());
|
||||
}
|
||||
|
||||
TEST_F(GncListOption, test_list_in)
|
||||
|
||||
Reference in New Issue
Block a user