Merge branch 'development' into cmake/SPEC-2513_w4018

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp
This commit is contained in:
Esteban Papp
2021-08-10 11:45:02 -07:00
1094 changed files with 33185 additions and 45041 deletions
@@ -31,8 +31,10 @@
#include <AzToolsFramework/Viewport/ActionBus.h>
#include <AzToolsFramework/ViewportSelection/EditorDefaultSelection.h>
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemViewportSelectionRequestBus.h>
#include <AzToolsFramework/ViewportSelection/EditorPickEntitySelection.h>
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h>
#include <AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.h>
#include <AzToolsFramework/ViewportUi/ViewportUiManager.h>
namespace AZ
{
@@ -188,6 +190,47 @@ namespace UnitTest
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// EditorTransformComponentSelection Tests
TEST_F(EditorTransformComponentSelectionFixture, Focus_is_not_changed_while_switching_viewport_interaction_request_instance)
{
// setup a dummy widget and make it the active window to ensure focus in/out events are fired
auto dummyWidget = AZStd::make_unique<QWidget>();
QApplication::setActiveWindow(dummyWidget.get());
// note: it is important to make sure the focus widget is parented to the dummy widget to have focus in/out events fire
auto focusWidget = AZStd::make_unique<UnitTest::FocusInteractionWidget>(dummyWidget.get());
const auto previousFocusWidget = QApplication::focusWidget();
// Given
// setup viewport ui system
AzToolsFramework::ViewportUi::ViewportUiManager viewportUiManager;
viewportUiManager.ConnectViewportUiBus(AzToolsFramework::ViewportUi::DefaultViewportId);
viewportUiManager.InitializeViewportUi(&m_editorActions.m_defaultWidget, focusWidget.get());
// begin EditorPickEntitySelection
using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(), &EditorInteractionSystemViewportSelectionRequestBus::Events::SetHandler,
[](const AzToolsFramework::EditorVisibleEntityDataCache* entityDataCache)
{
return AZStd::make_unique<AzToolsFramework::EditorPickEntitySelection>(entityDataCache);
});
// When
// a mouse event is sent to the focus widget (set to be the render overlay in the viewport ui system)
QTest::mouseClick(focusWidget.get(), Qt::MouseButton::LeftButton);
// Then
// focus should not change
EXPECT_FALSE(focusWidget->hasFocus());
EXPECT_EQ(previousFocusWidget, QApplication::focusWidget());
// clean up
viewportUiManager.DisconnectViewportUiBus();
focusWidget.reset();
dummyWidget.reset();
}
TEST_F(EditorTransformComponentSelectionFixture, ManipulatorOrientationIsResetWhenEntityOrientationIsReset)
{
using AzToolsFramework::EditorTransformComponentSelectionRequestBus;
@@ -245,12 +245,15 @@ namespace UnitTest
{
using testing::StrEq;
QLocale testLocale{ QLocale() };
QString testString = "10" + QString(testLocale.decimalPoint()) + "0";
m_doubleSpinBox->setSuffix("m");
m_doubleSpinBox->setValue(10.0);
// test internal logic (textFromValue() calls private StringValue())
QString value = m_doubleSpinBox->textFromValue(10.0);
EXPECT_THAT(value.toUtf8().constData(), StrEq("10.0"));
EXPECT_THAT(value.toUtf8().constData(), testString);
m_doubleSpinBox->setFocus();
EXPECT_THAT(m_doubleSpinBox->suffix().toUtf8().constData(), StrEq(""));
@@ -293,31 +296,44 @@ namespace UnitTest
TEST_F(SpinBoxFixture, SpinBoxCheckHighValueTruncatesCorrectly)
{
QString value = setupTruncationTest("0.9999999");
QLocale testLocale{ QLocale() };
QString testString = "0" + QString(testLocale.decimalPoint()) + "9999999";
QString value = setupTruncationTest(testString);
EXPECT_TRUE(value == "0.999");
testString = "0" + QString(testLocale.decimalPoint()) + "999";
EXPECT_TRUE(value == testString);
}
TEST_F(SpinBoxFixture, SpinBoxCheckLowValueTruncatesCorrectly)
{
QString value = setupTruncationTest("0.0000001");
QLocale testLocale{ QLocale() };
QString testString = "0" + QString(testLocale.decimalPoint()) + "0000001";
QString value = setupTruncationTest(testString);
EXPECT_TRUE(value == "0.0");
testString = "0" + QString(testLocale.decimalPoint()) + "0";
EXPECT_TRUE(value == testString);
}
TEST_F(SpinBoxFixture, SpinBoxCheckBugValuesTruncatesCorrectly)
{
QString value = setupTruncationTest("0.12395");
QLocale testLocale{ QLocale() };
QString testString = "0" + QString(testLocale.decimalPoint()) + "12395";
QString value = setupTruncationTest(testString);
EXPECT_TRUE(value == "0.123");
testString = "0" + QString(testLocale.decimalPoint()) + "123";
EXPECT_TRUE(value == testString);
value = setupTruncationTest("0.94496");
testString = "0" + QString(testLocale.decimalPoint()) + "94496";
value = setupTruncationTest(testString);
EXPECT_TRUE(value == "0.944");
testString = "0" + QString(testLocale.decimalPoint()) + "944";
EXPECT_TRUE(value == testString);
value = setupTruncationTest("0.0009999");
testString = "0" + QString(testLocale.decimalPoint()) + "0009999";
value = setupTruncationTest(testString);
EXPECT_TRUE(value == "0.0");
testString = "0" + QString(testLocale.decimalPoint()) + "0";
EXPECT_TRUE(value == testString);
}
} // namespace UnitTest