Reformatted Unit tests to give more information and be more concise, also changed the position of the toggle switch

Signed-off-by: dtamkin1 <jotamkin@amazon.com>
This commit is contained in:
dtamkin1
2021-07-23 16:21:07 -05:00
parent fed37e8e6d
commit fcb2a0f95c
3 changed files with 144 additions and 223 deletions
@@ -142,7 +142,7 @@ namespace AzToolsFramework
m_treeDepth = 0;
delete m_dropDownArrow;
if (m_toggleSwitch)
if (m_toggleSwitch != nullptr)
{
m_handler->DestroyGUI(m_toggleSwitch);
m_toggleSwitch = nullptr;
@@ -1117,12 +1117,13 @@ namespace AzToolsFramework
void PropertyRowWidget::CreateGroupToggleSwitch()
{
if (!m_toggleSwitch)
if (m_toggleSwitch == nullptr)
{
m_handlerName = AZ::Edit::UIHandlers::CheckBox;
PropertyTypeRegistrationMessages::Bus::BroadcastResult(m_handler, &PropertyTypeRegistrationMessages::Bus::Events::ResolvePropertyHandler, m_handlerName, azrtti_typeid<bool>());
m_toggleSwitch = m_handler->CreateGUI(this);
m_middleLayout->insertWidget(0, m_toggleSwitch, 1);
m_toggleSwitch->setFixedWidth(38);
m_middleLayout->addWidget(m_toggleSwitch, 1, Qt::AlignRight);
auto checkBoxCtrl = static_cast<AzToolsFramework::PropertyCheckBoxCtrl*>(m_toggleSwitch);
QObject::connect(checkBoxCtrl, &AzToolsFramework::PropertyCheckBoxCtrl::valueChanged, this, &PropertyRowWidget::OnClickedToggleButton);
}
@@ -501,6 +501,7 @@ namespace AzToolsFramework
// if the node is in a group then create the widget for the group
if (groupElementData)
{
bool isToggleGroup = false;
const char* groupName = groupElementData->m_description;
PropertyRowWidget*& widgetEntry = m_groupWidgets[{parent, groupName}];
@@ -526,6 +527,7 @@ namespace AzToolsFramework
pHandler->ConsumeAttributes_Internal(toggleSwitch, groupSourceNode);
pHandler->ReadValuesIntoGUI_Internal(toggleSwitch, groupSourceNode);
widgetEntry->OnValuesUpdated();
isToggleGroup = true;
}
widgetEntry->SetLeafIndentation(m_leafIndentation);
@@ -534,7 +536,8 @@ namespace AzToolsFramework
for (const AZ::Edit::AttributePair& attribute : groupElementData->m_attributes)
{
PropertyAttributeReader reader(node->GetParent()->FirstInstance(), attribute.second);
InstanceDataNode* readerNode = (isToggleGroup) ? groupSourceNode : node;
PropertyAttributeReader reader(readerNode->GetParent()->FirstInstance(), attribute.second);
QString descriptionOut;
bool foundDescription = false;
widgetEntry->ConsumeAttribute(attribute.first, reader, true, &descriptionOut, &foundDescription);