From 4e021db39a8dd70758f2cf16fb2f2b0d042dab2b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 21 Dec 2017 12:12:40 +0100 Subject: [PATCH] AppFwk : Tree Selection : Add test for switching between two list with same item count --- .../cafTestApplication/ManyGroups.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.cpp index 1df7bffb04..a631060d0c 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.cpp @@ -25,6 +25,8 @@ ManyGroups::ManyGroups() if (!(m_proxyDoubleField == 3)) { std::cout << "Double is not 3 " << std::endl; } CAF_PDM_InitFieldNoDefault(&m_multiSelectList, "SelectedItems", "Multi Select Field", "", "", ""); + m_multiSelectList.uiCapability()->setAutoAddingOptionFromValue(false); + m_multiSelectList.xmlCapability()->setIOReadable(false); m_multiSelectList.xmlCapability()->setIOWritable(false); m_multiSelectList.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); @@ -60,6 +62,29 @@ QList ManyGroups::calculateValueOptions(const caf::PdmFi { QList options; + // Test code used to switch between two lists with different content, but same item count + if (fieldNeedingOptions == &m_multiSelectList) + { + if (m_intField < 10) + { + QString text = "Apple 1"; + options.push_back(caf::PdmOptionItemInfo(text, text)); + + text = "Apple 2"; + options.push_back(caf::PdmOptionItemInfo(text, text)); + } + else + { + QString text = "Car 1"; + options.push_back(caf::PdmOptionItemInfo(text, text)); + + text = "Car 2"; + options.push_back(caf::PdmOptionItemInfo(text, text)); + } + + return options; + } + if (fieldNeedingOptions == &m_multiSelectList) { QString text;