make the string representations of floats and ints clearly distinguishable (inspector incl. remote, print, etc.)
This commit is contained in:
parent
168edcd376
commit
574535ae74
8 changed files with 12 additions and 8 deletions
|
@ -175,5 +175,5 @@ bool Plane::is_equal_approx(const Plane &p_plane) const {
|
|||
}
|
||||
|
||||
Plane::operator String() const {
|
||||
return "[N: " + normal.operator String() + ", D: " + String::num_real(d, false) + "]";
|
||||
return "[N: " + normal.operator String() + ", D: " + String::num_real(d, true) + "]";
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ Quaternion Quaternion::cubic_slerp(const Quaternion &p_b, const Quaternion &p_pr
|
|||
}
|
||||
|
||||
Quaternion::operator String() const {
|
||||
return "(" + String::num_real(x, false) + ", " + String::num_real(y, false) + ", " + String::num_real(z, false) + ", " + String::num_real(w, false) + ")";
|
||||
return "(" + String::num_real(x, true) + ", " + String::num_real(y, true) + ", " + String::num_real(z, true) + ", " + String::num_real(w, true) + ")";
|
||||
}
|
||||
|
||||
Vector3 Quaternion::get_axis() const {
|
||||
|
|
|
@ -190,7 +190,7 @@ bool Vector2::is_equal_approx(const Vector2 &p_v) const {
|
|||
}
|
||||
|
||||
Vector2::operator String() const {
|
||||
return "(" + String::num_real(x, false) + ", " + String::num_real(y, false) + ")";
|
||||
return "(" + String::num_real(x, true) + ", " + String::num_real(y, true) + ")";
|
||||
}
|
||||
|
||||
Vector2::operator Vector2i() const {
|
||||
|
|
|
@ -138,7 +138,7 @@ bool Vector3::is_equal_approx(const Vector3 &p_v) const {
|
|||
}
|
||||
|
||||
Vector3::operator String() const {
|
||||
return "(" + String::num_real(x, false) + ", " + String::num_real(y, false) + ", " + String::num_real(z, false) + ")";
|
||||
return "(" + String::num_real(x, true) + ", " + String::num_real(y, true) + ", " + String::num_real(z, true) + ")";
|
||||
}
|
||||
|
||||
Vector3::operator Vector3i() const {
|
||||
|
|
|
@ -1425,7 +1425,11 @@ String String::num(double p_num, int p_decimals) {
|
|||
if (buf[z] == '0') {
|
||||
buf[z] = 0;
|
||||
} else if (buf[z] == '.') {
|
||||
buf[z] = 0;
|
||||
if (z == 254) {
|
||||
buf[z] = 0;
|
||||
} else {
|
||||
buf[z + 1] = '0';
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
|
|
|
@ -48,7 +48,7 @@ TEST_CASE("[AABB] Constructor methods") {
|
|||
|
||||
TEST_CASE("[AABB] String conversion") {
|
||||
CHECK_MESSAGE(
|
||||
String(AABB(Vector3(-1.5, 2, -2.5), Vector3(4, 5, 6))) == "[P: (-1.5, 2, -2.5), S: (4, 5, 6)]",
|
||||
String(AABB(Vector3(-1.5, 2, -2.5), Vector3(4, 5, 6))) == "[P: (-1.5, 2, -2.5), S: (4.0, 5.0, 6.0)]",
|
||||
"The string representation should match the expected value.");
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ TEST_CASE("[Color] Conversion methods") {
|
|||
cyan.to_rgba64() == 0x0000'ffff'ffff'ffff,
|
||||
"The returned 64-bit BGR number should match the expected value.");
|
||||
CHECK_MESSAGE(
|
||||
String(cyan) == "(0, 1, 1, 1)",
|
||||
String(cyan) == "(0.0, 1.0, 1.0, 1.0)",
|
||||
"The string representation should match the expected value.");
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ TEST_CASE("[Rect2] Constructor methods") {
|
|||
TEST_CASE("[Rect2] String conversion") {
|
||||
// Note: This also depends on the Vector2 string representation.
|
||||
CHECK_MESSAGE(
|
||||
String(Rect2(0, 100, 1280, 720)) == "[P: (0, 100), S: (1280, 720)]",
|
||||
String(Rect2(0, 100, 1280, 720)) == "[P: (0.0, 100.0), S: (1280.0, 720.0)]",
|
||||
"The string representation should match the expected value.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue