summaryrefslogtreecommitdiffstats
path: root/tools/qa
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-07-29 00:02:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-07-29 10:56:42 +0100
commit8291b5884c1c4c5278473886cdf1bb0f022aac99 (patch)
treefabf4cca874951f459e63145f1a94aff1be540d4 /tools/qa
parentcallcatcher: ditch various unused methods (diff)
downloadcore-8291b5884c1c4c5278473886cdf1bb0f022aac99.tar.gz
core-8291b5884c1c4c5278473886cdf1bb0f022aac99.zip
make stream operators leave variables in original state on failure
this aligns them with the behaviour of std::stream, and makes things like sal_uInt32 n(0); rSt >> n; if (n) { ... } safe if there was a short read of e.g. 3 bytes instead of the required 4
Diffstat (limited to 'tools/qa')
-rw-r--r--tools/qa/cppunit/test_streamstate.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/qa/cppunit/test_streamstate.cxx b/tools/qa/cppunit/test_streamstate.cxx
index c2a4be0c5e00..182ad6c45561 100644
--- a/tools/qa/cppunit/test_streamstate.cxx
+++ b/tools/qa/cppunit/test_streamstate.cxx
@@ -94,6 +94,9 @@ namespace
//yet, the read didn't succeed
CPPUNIT_ASSERT(!aMemStream.good());
+ //set things up so that there is only one byte available on an attempt
+ //to read a two-byte sal_uInt16. The byte should be consumed, but the
+ //operation should fail, and tools_b should remain unchanged,
sal_uInt16 tools_b = 0x1122;
aMemStream.SeekRel(-1);
CPPUNIT_ASSERT(!aMemStream.eof());
@@ -101,7 +104,7 @@ namespace
aMemStream >> tools_b;
CPPUNIT_ASSERT(!aMemStream.good());
CPPUNIT_ASSERT(aMemStream.eof());
-// CPPUNIT_ASSERT(tools_b == 0x1122); //nasty, real nasty
+ CPPUNIT_ASSERT(tools_b == 0x1122);
iss.clear();
iss.seekg(0);