@@ -780,6 +780,38 @@ TEST(TargetTest, BubbleText)
780780 target.setBubbleText (longstr);
781781 ASSERT_EQ (target.bubbleText ().length (), 330 );
782782 ASSERT_EQ (target.bubbleText (), longstr.substr (0 , 330 ));
783+
784+ // Integers should be left unchanged
785+ target.setBubbleText (" 8" );
786+ ASSERT_EQ (target.bubbleText (), " 8" );
787+
788+ target.setBubbleText (" -52" );
789+ ASSERT_EQ (target.bubbleText (), " -52" );
790+
791+ target.setBubbleText (" 0" );
792+ ASSERT_EQ (target.bubbleText (), " 0" );
793+
794+ // Non-integers should be rounded to 2 decimal places (no more, no less), unless they're small enough that rounding would display them as 0.00 (#478)
795+ target.setBubbleText (" 8.324" );
796+ ASSERT_EQ (target.bubbleText (), " 8.32" );
797+
798+ target.setBubbleText (" -52.576" );
799+ ASSERT_EQ (target.bubbleText (), " -52.58" );
800+
801+ target.setBubbleText (" 3.5" );
802+ ASSERT_EQ (target.bubbleText (), " 3.5" );
803+
804+ target.setBubbleText (" 0.015" );
805+ ASSERT_EQ (target.bubbleText (), " 0.02" );
806+
807+ target.setBubbleText (" -0.015" );
808+ ASSERT_EQ (target.bubbleText (), " -0.02" );
809+
810+ target.setBubbleText (" 0.005" );
811+ ASSERT_EQ (target.bubbleText (), " 0.005" );
812+
813+ target.setBubbleText (" -0.005" );
814+ ASSERT_EQ (target.bubbleText (), " -0.005" );
783815}
784816
785817TEST (TargetTest, Engine)
0 commit comments