summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests/llsdserialize_test.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2026-08-13 04:19:15 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2026-08-13 04:19:15 +0300
commitf376c52ee2a22b3b58263d86566394e80626fc1a (patch)
tree012d0585b39ef5cd1eac25f4f783d930ff50dff6 /indra/llcommon/tests/llsdserialize_test.cpp
parent21bb60fc65e7fa6c3cf472a29cda220f653af1d8 (diff)
parente3a92a3f8e7d6df3772adcecb037149e6fcf0f3e (diff)
Merge branch 'geenz/linux-to-develop' into marchcat/lua-linux-develop
# Conflicts: # .github/workflows/build.yaml # indra/llinventory/llinventory.cpp # indra/newview/CMakeLists.txt # indra/newview/llappviewer.cpp # indra/newview/llappviewerwin32.cpp # indra/newview/llviewermenu.cpp # indra/newview/llvoiceclient.cpp # indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
Diffstat (limited to 'indra/llcommon/tests/llsdserialize_test.cpp')
-rw-r--r--indra/llcommon/tests/llsdserialize_test.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp
index a7abfda099..71096523a9 100644
--- a/indra/llcommon/tests/llsdserialize_test.cpp
+++ b/indra/llcommon/tests/llsdserialize_test.cpp
@@ -243,6 +243,58 @@ namespace tut
xml_test("binary", expected);
}
+ template<> template<>
+ void sd_xml_object::test<7>()
+ {
+ // Test that stream state (precision and exceptions) is correctly restored after format()
+ {
+ std::ostringstream ostr;
+
+ // Set custom precision
+ ostr.precision(10);
+
+ // Set some exception bits
+ ostr.exceptions(std::ios_base::badbit);
+ std::ios_base::iostate original_exceptions = ostr.exceptions();
+
+ // Format some LLSD data
+ mSD = 3.141592653589793;
+ S32 result = mFormatter->format(mSD, ostr);
+
+ // Verify formatting succeeded
+ ensure("format should succeed", result >= 0);
+
+ // Verify precision was restored
+ ensure_equals("precision should be restored",
+ ostr.precision(), 10);
+
+ // Verify exceptions were restored
+ ensure_equals("exception bits should be restored",
+ ostr.exceptions(), original_exceptions);
+ }
+
+ // Test with no bits set
+ {
+ std::ostringstream ostr;
+ ostr.precision(5);
+ std::ios_base::iostate original_exceptions = ostr.exceptions(); // 0
+
+ mSD = "test";
+ S32 result = mFormatter->format(mSD, ostr);
+
+ // Verify formatting succeeded
+ ensure("format should succeed", result >= 0);
+
+ // Verify exceptions were removed
+ ensure_equals("exception bits should remain unchanged",
+ ostr.exceptions(), original_exceptions);
+
+ // Verify precision was still restored even on failure
+ ensure_equals("precision should be restored even on stream failure",
+ ostr.precision(), (std::streamsize)5);
+ }
+ }
+
class TestLLSDSerializeData
{
public: