소스 검색

fix unit test

Signed-off-by: mrieggeramzn <[email protected]>
mrieggeramzn 3 년 전
부모
커밋
7d9f9f99e6
1개의 변경된 파일13개의 추가작업 그리고 16개의 파일을 삭제
  1. 13 16
      Code/Framework/AzToolsFramework/Tests/PropertyIntCtrlCommonTests.h

+ 13 - 16
Code/Framework/AzToolsFramework/Tests/PropertyIntCtrlCommonTests.h

@@ -12,6 +12,7 @@
 #include <AzCore/std/typetraits/is_signed.h>
 #include <AzCore/std/typetraits/is_signed.h>
 #include "IntegerPrimtitiveTestConfig.h"
 #include "IntegerPrimtitiveTestConfig.h"
 #include <QApplication>
 #include <QApplication>
+#include <QLocale.h>
 #include <sstream>
 #include <sstream>
 
 
 namespace UnitTest
 namespace UnitTest
@@ -83,18 +84,6 @@ namespace UnitTest
             widget->setMaximum(widget->maximum() - 1);
             widget->setMaximum(widget->maximum() - 1);
         }
         }
 
 
-        static std::string GetToolTipStringAtLimits()
-        {
-            if constexpr (std::is_signed<ValueType>::value)
-            {
-                return "[-INF, INF]";
-            }
-            else
-            {
-                return "[0, INF]";
-            }
-        }
-
         void PropertyCtrlHandlersCreated()
         void PropertyCtrlHandlersCreated()
         {
         {
             using ::testing::Ne;
             using ::testing::Ne;
@@ -125,15 +114,19 @@ namespace UnitTest
             auto& widget = m_widget;
             auto& widget = m_widget;
             auto& handler = m_handler;
             auto& handler = m_handler;
             QString tooltip;
             QString tooltip;
-            std::string expected;
+            std::stringstream expected;
 
 
             // Retrieve the tooltip string for this widget
             // Retrieve the tooltip string for this widget
             auto success = handler->ModifyTooltip(widget, tooltip);
             auto success = handler->ModifyTooltip(widget, tooltip);
-            expected = GetToolTipStringAtLimits();
+
+            const QString minString = QLocale().toString(widget->minimum());
+            const QString maxString = QLocale().toString(widget->maximum());
+
+            expected << "[" << minString.toStdString() << ", " << maxString.toStdString() << "]";
 
 
             // Expect the operation to be successful and a valid limit tooltip string generated
             // Expect the operation to be successful and a valid limit tooltip string generated
             EXPECT_TRUE(success);
             EXPECT_TRUE(success);
-            EXPECT_STREQ(tooltip.toStdString().c_str(), expected.c_str());
+            EXPECT_STREQ(tooltip.toStdString().c_str(), expected.str().c_str());
         }
         }
 
 
         void HandlerMinMaxLessLimit_ModifyHandler_ExpectSuccessAndValidLessLimitToolTipString()
         void HandlerMinMaxLessLimit_ModifyHandler_ExpectSuccessAndValidLessLimitToolTipString()
@@ -149,7 +142,11 @@ namespace UnitTest
 
 
             // Retrieve the tooltip string for this widget
             // Retrieve the tooltip string for this widget
             auto success = handler->ModifyTooltip(widget, tooltip);
             auto success = handler->ModifyTooltip(widget, tooltip);
-            expected << "[" << widget->minimum() << ", " << widget->maximum() << "]";
+
+            const QString minString = QLocale().toString(widget->minimum());
+            const QString maxString = QLocale().toString(widget->maximum());
+
+            expected << "[" << minString.toStdString() << ", " << maxString.toStdString() << "]";
 
 
             // Expect the operation to be successful and a valid less than limit tooltip string generated
             // Expect the operation to be successful and a valid less than limit tooltip string generated
             EXPECT_TRUE(success);
             EXPECT_TRUE(success);