Merge branch 'development' of https://github.com/o3de/o3de into GroupToggleSwitch
This commit is contained in:
@@ -102,7 +102,7 @@ namespace Camera
|
||||
using EditorCameraNotificationBus = AZ::EBus<EditorCameraNotifications>;
|
||||
|
||||
/**
|
||||
* This bus is for requesting any camera-view-related changes
|
||||
* This bus is for requesting any camera-view-related changes or information
|
||||
*/
|
||||
class EditorCameraViewRequests : public AZ::ComponentBus
|
||||
{
|
||||
@@ -115,6 +115,11 @@ namespace Camera
|
||||
* Sets this camera as the active view in the scene, otherwise restores the default editor camera if it was already active
|
||||
*/
|
||||
virtual void ToggleCameraAsActiveView() = 0;
|
||||
|
||||
/**
|
||||
* Gets the camera state associated with this view.
|
||||
*/
|
||||
virtual bool GetCameraState(AzFramework::CameraState& cameraState) = 0;
|
||||
};
|
||||
|
||||
using EditorCameraViewRequestBus = AZ::EBus<EditorCameraViewRequests>;
|
||||
|
||||
@@ -77,6 +77,19 @@ namespace UnitTest
|
||||
m_intSpinBox.reset();
|
||||
}
|
||||
|
||||
QString setupTruncationTest(QString textValue)
|
||||
{
|
||||
QString retval;
|
||||
m_doubleSpinBoxWithLineEdit->setDecimals(7);
|
||||
m_doubleSpinBoxWithLineEdit->setDisplayDecimals(3);
|
||||
m_doubleSpinBoxWithLineEdit->setFocus();
|
||||
m_doubleSpinBoxWithLineEdit->GetLineEdit()->setText(textValue);
|
||||
m_doubleSpinBoxWithLineEdit->clearFocus();
|
||||
|
||||
return m_doubleSpinBoxWithLineEdit->textFromValue(m_doubleSpinBoxWithLineEdit->value());
|
||||
}
|
||||
|
||||
|
||||
AZStd::unique_ptr<QWidget> m_dummyWidget;
|
||||
AZStd::unique_ptr<AzQtComponents::SpinBox> m_intSpinBox;
|
||||
AZStd::unique_ptr<AzQtComponents::DoubleSpinBox> m_doubleSpinBox;
|
||||
@@ -277,4 +290,34 @@ namespace UnitTest
|
||||
// test would result in a crash
|
||||
EXPECT_TRUE(m_intSpinBox.get() == nullptr);
|
||||
}
|
||||
|
||||
TEST_F(SpinBoxFixture, SpinBoxCheckHighValueTruncatesCorrectly)
|
||||
{
|
||||
QString value = setupTruncationTest("0.9999999");
|
||||
|
||||
EXPECT_TRUE(value == "0.999");
|
||||
}
|
||||
|
||||
TEST_F(SpinBoxFixture, SpinBoxCheckLowValueTruncatesCorrectly)
|
||||
{
|
||||
QString value = setupTruncationTest("0.0000001");
|
||||
|
||||
EXPECT_TRUE(value == "0.0");
|
||||
}
|
||||
|
||||
TEST_F(SpinBoxFixture, SpinBoxCheckBugValuesTruncatesCorrectly)
|
||||
{
|
||||
QString value = setupTruncationTest("0.12395");
|
||||
|
||||
EXPECT_TRUE(value == "0.123");
|
||||
|
||||
value = setupTruncationTest("0.94496");
|
||||
|
||||
EXPECT_TRUE(value == "0.944");
|
||||
|
||||
value = setupTruncationTest("0.0009999");
|
||||
|
||||
EXPECT_TRUE(value == "0.0");
|
||||
}
|
||||
|
||||
} // namespace UnitTest
|
||||
|
||||
Reference in New Issue
Block a user