// // OctreeTests.h // tests/octree/src // // Created by Brad Hefta-Gaub on 06/04/2014. // Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // // TODO: // * need to add expected results and accumulation of test success/failure // #include #include #include #include #include #include #include #include #include #include "OctreeTests.h" enum ExamplePropertyList { EXAMPLE_PROP_PAGED_PROPERTY, EXAMPLE_PROP_CUSTOM_PROPERTIES_INCLUDED, EXAMPLE_PROP_VISIBLE, EXAMPLE_PROP_POSITION, EXAMPLE_PROP_RADIUS, EXAMPLE_PROP_MODEL_URL, EXAMPLE_PROP_COLLISION_MODEL_URL, EXAMPLE_PROP_ROTATION, EXAMPLE_PROP_COLOR, EXAMPLE_PROP_SCRIPT, EXAMPLE_PROP_ANIMATION_URL, EXAMPLE_PROP_ANIMATION_FPS, EXAMPLE_PROP_ANIMATION_FRAME_INDEX, EXAMPLE_PROP_ANIMATION_PLAYING, EXAMPLE_PROP_SHOULD_BE_DELETED, EXAMPLE_PROP_VELOCITY, EXAMPLE_PROP_GRAVITY, EXAMPLE_PROP_DAMPING, EXAMPLE_PROP_MASS, EXAMPLE_PROP_LIFETIME, EXAMPLE_PROP_PAUSE_SIMULATION, }; typedef PropertyFlags ExamplePropertyFlags; QTEST_MAIN(OctreeTests) void OctreeTests::propertyFlagsTests() { bool verbose = true; qDebug() << "FIXME: this test is broken and needs to be fixed."; qDebug() << "We're disabling this so that ALL_BUILD works"; return; if (verbose) { qDebug() << "******************************************************************************************"; } qDebug() << "OctreeTests::propertyFlagsTests()"; { if (verbose) { qDebug() << "Test 1: EntityProperties: using setHasProperty()"; } EntityPropertyFlags props; props.setHasProperty(PROP_VISIBLE); props.setHasProperty(PROP_POSITION); props.setHasProperty(PROP_RADIUS); props.setHasProperty(PROP_MODEL_URL); props.setHasProperty(PROP_COMPOUND_SHAPE_URL); props.setHasProperty(PROP_ROTATION); QByteArray encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 13 })); } { if (verbose) { qDebug() << "Test 2: ExamplePropertyFlags: using setHasProperty()"; } EntityPropertyFlags props2; props2.setHasProperty(PROP_VISIBLE); props2.setHasProperty(PROP_ANIMATION_URL); props2.setHasProperty(PROP_ANIMATION_FPS); props2.setHasProperty(PROP_ANIMATION_FRAME_INDEX); props2.setHasProperty(PROP_ANIMATION_PLAYING); QByteArray encoded = props2.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 196, 15, 2 })); if (verbose) { qDebug() << "Test 2b: remove flag with setHasProperty() PROP_PAUSE_SIMULATION"; } encoded = props2.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 136, 30 })); } { if (verbose) { qDebug() << "Test 3: ExamplePropertyFlags: using | operator"; } ExamplePropertyFlags props; props = ExamplePropertyFlags(EXAMPLE_PROP_VISIBLE) | ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_URL) | ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_FPS) | ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_FRAME_INDEX) | ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_PLAYING) | ExamplePropertyFlags(EXAMPLE_PROP_PAUSE_SIMULATION); QByteArray encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 196, 15, 2 })); if (verbose) { qDebug() << "Test 3b: remove flag with -= EXAMPLE_PROP_PAUSE_SIMULATION"; } props -= EXAMPLE_PROP_PAUSE_SIMULATION; encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 136, 30 })); } { if (verbose) { qDebug() << "Test 3c: ExamplePropertyFlags: using |= operator"; } ExamplePropertyFlags props; props |= EXAMPLE_PROP_VISIBLE; props |= EXAMPLE_PROP_ANIMATION_URL; props |= EXAMPLE_PROP_ANIMATION_FPS; props |= EXAMPLE_PROP_ANIMATION_FRAME_INDEX; props |= EXAMPLE_PROP_ANIMATION_PLAYING; props |= EXAMPLE_PROP_PAUSE_SIMULATION; QByteArray encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 196, 15, 2 })); } { if (verbose) { qDebug() << "Test 4: ExamplePropertyFlags: using + operator"; } ExamplePropertyFlags props; props = ExamplePropertyFlags(EXAMPLE_PROP_VISIBLE) + ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_URL) + ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_FPS) + ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_FRAME_INDEX) + ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_PLAYING) + ExamplePropertyFlags(EXAMPLE_PROP_PAUSE_SIMULATION); QByteArray encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 196, 15, 2 })); } { if (verbose) { qDebug() << "Test 5: ExamplePropertyFlags: using += operator"; } ExamplePropertyFlags props; props += EXAMPLE_PROP_VISIBLE; props += EXAMPLE_PROP_ANIMATION_URL; props += EXAMPLE_PROP_ANIMATION_FPS; props += EXAMPLE_PROP_ANIMATION_FRAME_INDEX; props += EXAMPLE_PROP_ANIMATION_PLAYING; props += EXAMPLE_PROP_PAUSE_SIMULATION; QByteArray encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 196, 15, 2 })); } { if (verbose) { qDebug() << "Test 6: ExamplePropertyFlags: using = ... << operator"; } ExamplePropertyFlags props; props = ExamplePropertyFlags(EXAMPLE_PROP_VISIBLE) << ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_URL) << ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_FPS) << ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_FRAME_INDEX) << ExamplePropertyFlags(EXAMPLE_PROP_ANIMATION_PLAYING) << ExamplePropertyFlags(EXAMPLE_PROP_PAUSE_SIMULATION); QByteArray encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 196, 15, 2 })); } { if (verbose) { qDebug() << "Test 7: ExamplePropertyFlags: using <<= operator"; } ExamplePropertyFlags props; props <<= EXAMPLE_PROP_VISIBLE; props <<= EXAMPLE_PROP_ANIMATION_URL; props <<= EXAMPLE_PROP_ANIMATION_FPS; props <<= EXAMPLE_PROP_ANIMATION_FRAME_INDEX; props <<= EXAMPLE_PROP_ANIMATION_PLAYING; props <<= EXAMPLE_PROP_PAUSE_SIMULATION; QByteArray encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 196, 15, 2 })); } { if (verbose) { qDebug() << "Test 8: ExamplePropertyFlags: using << enum operator"; } ExamplePropertyFlags props; props << EXAMPLE_PROP_VISIBLE; props << EXAMPLE_PROP_ANIMATION_URL; props << EXAMPLE_PROP_ANIMATION_FPS; props << EXAMPLE_PROP_ANIMATION_FRAME_INDEX; props << EXAMPLE_PROP_ANIMATION_PLAYING; props << EXAMPLE_PROP_PAUSE_SIMULATION; QByteArray encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 196, 15, 2 })); } { if (verbose) { qDebug() << "Test 9: ExamplePropertyFlags: using << flags operator "; } ExamplePropertyFlags props; ExamplePropertyFlags props2; props << EXAMPLE_PROP_VISIBLE; props << EXAMPLE_PROP_ANIMATION_URL; props << EXAMPLE_PROP_ANIMATION_FPS; props2 << EXAMPLE_PROP_ANIMATION_FRAME_INDEX; props2 << EXAMPLE_PROP_ANIMATION_PLAYING; props2 << EXAMPLE_PROP_PAUSE_SIMULATION; props << props2; QByteArray encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 196, 15, 2 })); } { if (verbose) { qDebug() << "Test 10: ExamplePropertyFlags comparison"; } ExamplePropertyFlags propsA; if (verbose) { qDebug() << "!propsA:" << (!propsA) << "{ expect true }"; } QCOMPARE(!propsA, true); propsA << EXAMPLE_PROP_VISIBLE; propsA << EXAMPLE_PROP_ANIMATION_URL; propsA << EXAMPLE_PROP_ANIMATION_FPS; propsA << EXAMPLE_PROP_ANIMATION_FRAME_INDEX; propsA << EXAMPLE_PROP_ANIMATION_PLAYING; propsA << EXAMPLE_PROP_PAUSE_SIMULATION; QCOMPARE(!propsA, false); ExamplePropertyFlags propsB; propsB << EXAMPLE_PROP_VISIBLE; propsB << EXAMPLE_PROP_ANIMATION_URL; propsB << EXAMPLE_PROP_ANIMATION_FPS; propsB << EXAMPLE_PROP_ANIMATION_FRAME_INDEX; propsB << EXAMPLE_PROP_ANIMATION_PLAYING; propsB << EXAMPLE_PROP_PAUSE_SIMULATION; if (verbose) { qDebug() << "propsA == propsB:" << (propsA == propsB) << "{ expect true }"; qDebug() << "propsA != propsB:" << (propsA != propsB) << "{ expect false }"; } QCOMPARE(propsA == propsB, true); QCOMPARE(propsA != propsB, false); if (verbose) { qDebug() << "AFTER propsB -= EXAMPLE_PROP_PAUSE_SIMULATION..."; } propsB -= EXAMPLE_PROP_PAUSE_SIMULATION; QCOMPARE(propsA == propsB, false); if (verbose) { qDebug() << "AFTER propsB = propsA..."; } propsB = propsA; QCOMPARE(propsA == propsB, true); } { if (verbose) { qDebug() << "Test 11: ExamplePropertyFlags testing individual properties"; } ExamplePropertyFlags props; if (verbose) { qDebug() << "ExamplePropertyFlags props;"; } QByteArray encoded = props.encode(); if (verbose) { qDebug() << "Test 11b: props.getHasProperty(EXAMPLE_PROP_VISIBLE)" << (props.getHasProperty(EXAMPLE_PROP_VISIBLE)) << "{ expect false }"; } QCOMPARE(props.getHasProperty(EXAMPLE_PROP_VISIBLE), false); if (verbose) { qDebug() << "props << EXAMPLE_PROP_VISIBLE;"; } props << EXAMPLE_PROP_VISIBLE; QCOMPARE(props.getHasProperty(EXAMPLE_PROP_VISIBLE), true); encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 16 })); if (verbose) { qDebug() << "props << EXAMPLE_PROP_ANIMATION_URL;"; } props << EXAMPLE_PROP_ANIMATION_URL; encoded = props.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 136, 16})); QCOMPARE(props.getHasProperty(EXAMPLE_PROP_VISIBLE), true); if (verbose) { qDebug() << "props << ... more ..."; } props << EXAMPLE_PROP_ANIMATION_FPS; props << EXAMPLE_PROP_ANIMATION_FRAME_INDEX; props << EXAMPLE_PROP_ANIMATION_PLAYING; props << EXAMPLE_PROP_PAUSE_SIMULATION; encoded = props.encode(); QCOMPARE(props.getHasProperty(EXAMPLE_PROP_VISIBLE), true); if (verbose) { qDebug() << "ExamplePropertyFlags propsB = props & EXAMPLE_PROP_VISIBLE;"; } ExamplePropertyFlags propsB = props & EXAMPLE_PROP_VISIBLE; QCOMPARE(propsB.getHasProperty(EXAMPLE_PROP_VISIBLE), true); encoded = propsB.encode(); QCOMPARE(encoded, makeQByteArray({ (char) 16 })); if (verbose) { qDebug() << "ExamplePropertyFlags propsC = ~propsB;"; } ExamplePropertyFlags propsC = ~propsB; QCOMPARE(propsC.getHasProperty(EXAMPLE_PROP_VISIBLE), false); encoded = propsC.encode(); if (verbose) { qDebug() << "propsC... encoded="; outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } } { if (verbose) { qDebug() << "Test 12: ExamplePropertyFlags: decode tests"; } ExamplePropertyFlags props; props << EXAMPLE_PROP_VISIBLE; props << EXAMPLE_PROP_ANIMATION_URL; props << EXAMPLE_PROP_ANIMATION_FPS; props << EXAMPLE_PROP_ANIMATION_FRAME_INDEX; props << EXAMPLE_PROP_ANIMATION_PLAYING; props << EXAMPLE_PROP_PAUSE_SIMULATION; QByteArray encoded = props.encode(); if (verbose) { qDebug() << "encoded="; outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); qDebug() << "encoded.size()=" << encoded.size(); } ExamplePropertyFlags propsDecoded; propsDecoded.decode(encoded); QCOMPARE(propsDecoded, props); QByteArray encodedAfterDecoded = propsDecoded.encode(); QCOMPARE(encoded, encodedAfterDecoded); if (verbose) { qDebug() << "fill encoded byte array with extra garbage (as if it was bitstream with more content)"; } QByteArray extraContent; extraContent.fill(0xbaU, 10); encoded.append(extraContent); if (verbose) { qDebug() << "encoded.size()=" << encoded.size() << "includes extra garbage"; } ExamplePropertyFlags propsDecodedExtra; propsDecodedExtra.decode(encoded); QCOMPARE(propsDecodedExtra, props); QByteArray encodedAfterDecodedExtra = propsDecodedExtra.encode(); if (verbose) { qDebug() << "encodedAfterDecodedExtra="; outputBufferBits((const unsigned char*)encodedAfterDecodedExtra.constData(), encodedAfterDecodedExtra.size()); } } { if (verbose) { qDebug() << "Test 13: ExamplePropertyFlags: QByteArray << / >> tests"; } ExamplePropertyFlags props; props << EXAMPLE_PROP_VISIBLE; props << EXAMPLE_PROP_ANIMATION_URL; props << EXAMPLE_PROP_ANIMATION_FPS; props << EXAMPLE_PROP_ANIMATION_FRAME_INDEX; props << EXAMPLE_PROP_ANIMATION_PLAYING; props << EXAMPLE_PROP_PAUSE_SIMULATION; if (verbose) { qDebug() << "testing encoded << props"; } QByteArray encoded; encoded << props; if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } ExamplePropertyFlags propsDecoded; if (verbose) { qDebug() << "testing encoded >> propsDecoded"; } encoded >> propsDecoded; QCOMPARE(propsDecoded, props); } if (verbose) { qDebug() << "******************************************************************************************"; } } typedef ByteCountCoded ByteCountCodedUINT; typedef ByteCountCoded ByteCountCodedQUINT64; typedef ByteCountCoded ByteCountCodedINT; void OctreeTests::byteCountCodingTests() { bool verbose = true; qDebug() << "FIXME: this test is broken and needs to be fixed."; qDebug() << "We're disabling this so that ALL_BUILD works"; return; if (verbose) { qDebug() << "******************************************************************************************"; } qDebug() << "OctreeTests::byteCountCodingTests()"; QByteArray encoded; if (verbose) { qDebug() << "ByteCountCodedUINT zero(0)"; } ByteCountCodedUINT zero(0); encoded = zero.encode(); if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } ByteCountCodedUINT decodedZero; decodedZero.decode(encoded); QCOMPARE(decodedZero.data, static_cast( 0 )); QCOMPARE(decodedZero, zero); ByteCountCodedUINT decodedZeroB(encoded); QCOMPARE(decodedZeroB.data, (unsigned int) 0); if (verbose) { qDebug() << "ByteCountCodedUINT foo(259)"; } ByteCountCodedUINT foo(259); encoded = foo.encode(); if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } ByteCountCodedUINT decodedFoo; decodedFoo.decode(encoded); QCOMPARE(decodedFoo.data, (unsigned int) 259); QCOMPARE(decodedFoo, foo); ByteCountCodedUINT decodedFooB(encoded); QCOMPARE(decodedFooB.data, (unsigned int) 259); if (verbose) { qDebug() << "ByteCountCodedUINT bar(1000000)"; } ByteCountCodedUINT bar(1000000); encoded = bar.encode(); if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } ByteCountCodedUINT decodedBar; decodedBar.decode(encoded); QCOMPARE(decodedBar.data, (unsigned int) 1000000); QCOMPARE(decodedBar, bar); if (verbose) { qDebug() << "ByteCountCodedUINT spam(4294967295/2)"; } ByteCountCodedUINT spam(4294967295/2); encoded = spam.encode(); if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } ByteCountCodedUINT decodedSpam; decodedSpam.decode(encoded); if (verbose) { qDebug() << "decodedSpam=" << decodedSpam.data; qDebug() << "decodedSpam==spam" << (decodedSpam==spam) << " { expected true } "; } QCOMPARE(decodedSpam.data, (unsigned int) 4294967295/2); QCOMPARE(decodedSpam, spam); if (verbose) { qDebug() << "ByteCountCodedQUINT64 foo64(259)"; } ByteCountCodedQUINT64 foo64(259); encoded = foo64.encode(); if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } if (verbose) { qDebug() << "testing... quint64 foo64POD = foo64;"; } quint64 foo64POD = foo64; if (verbose) { qDebug() << "foo64POD=" << foo64POD; } QCOMPARE(foo64POD, (quint64) 259); if (verbose) { qDebug() << "testing... encoded = foo64;"; } encoded = foo64; if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } ByteCountCodedQUINT64 decodedFoo64; decodedFoo64 = encoded; if (verbose) { qDebug() << "decodedFoo64=" << decodedFoo64.data; qDebug() << "decodedFoo64==foo64" << (decodedFoo64==foo64) << " { expected true } "; } QCOMPARE(decodedFoo.data, (unsigned int) 259); QCOMPARE(decodedFoo64, foo64); if (verbose) { qDebug() << "ByteCountCodedQUINT64 bar64(1000000)"; } ByteCountCodedQUINT64 bar64(1000000); encoded = bar64.encode(); if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } ByteCountCodedQUINT64 decodedBar64; decodedBar64.decode(encoded); QCOMPARE(decodedBar64.data, static_cast( 1000000 )); QCOMPARE(decodedBar64, bar64); if (verbose) { qDebug() << "ByteCountCodedQUINT64 spam64(4294967295/2)"; } ByteCountCodedQUINT64 spam64(4294967295/2); encoded = spam64.encode(); if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } ByteCountCodedQUINT64 decodedSpam64; decodedSpam64.decode(encoded); QCOMPARE(decodedSpam64.data, static_cast( 4294967295/2 )); QCOMPARE(decodedSpam64, spam64); if (verbose) { qDebug() << "testing encoded << spam64"; } encoded.clear(); encoded << spam64; if (verbose) { outputBufferBits((const unsigned char*)encoded.constData(), encoded.size()); } if (verbose) { qDebug() << "testing encoded >> decodedSpam64"; } encoded >> decodedSpam64; QCOMPARE(decodedSpam64, spam64); if (verbose) { qDebug() << "NOW..."; } quint64 now = usecTimestampNow(); ByteCountCodedQUINT64 nowCoded = now; QByteArray nowEncoded = nowCoded; ByteCountCodedQUINT64 decodedNow = nowEncoded; QCOMPARE(decodedNow.data, static_cast( now )); if (verbose) { qDebug() << "******************************************************************************************"; } if (verbose) { qDebug() << "******************************************************************************************"; } } void OctreeTests::modelItemTests() { #if 0 // TODO - repair/replace these bool verbose = true; //verbose = true; EntityTreeElementExtraEncodeData modelTreeElementExtraEncodeData; int testsTaken = 0; int testsPassed = 0; int testsFailed = 0; if (verbose) { qDebug() << "******************************************************************************************"; } qDebug() << "OctreeTests::modelItemTests()"; EncodeBitstreamParams params; OctreePacketData packetData; EntityItem entityItem; entityItem.setID(1042); entityItem.setModelURL("http://foo.com/foo.fbx"); bool appendResult = entityItem.appendEntityData(&packetData, params, &modelTreeElementExtraEncodeData); int bytesWritten = packetData.getUncompressedSize(); if (verbose) { qDebug() << "Test 1: bytesRead == bytesWritten ..."; qDebug() << "appendResult=" << appendResult; qDebug() << "bytesWritten=" << bytesWritten; } { ReadBitstreamToTreeParams args; EntityItem modelItemFromBuffer; const unsigned char* data = packetData.getUncompressedData(); int bytesLeftToRead = packetData.getUncompressedSize(); int bytesRead = modelItemFromBuffer.readEntityDataFromBuffer(data, bytesLeftToRead, args); if (verbose) { qDebug() << "bytesRead=" << bytesRead; qDebug() << "modelItemFromBuffer.getID()=" << modelItemFromBuffer.getID(); qDebug() << "modelItemFromBuffer.getModelURL()=" << modelItemFromBuffer.getModelURL(); } QCOMPARE(bytesRead, bytesWritten); if (verbose) { qDebug() << "Test 2: modelItemFromBuffer.getModelURL() == 'http://foo.com/foo.fbx'"; } QCOMPARE(modelItemFromBuffer.getModelURL(), "http://foo.com/foo.fbx"); } // TEST 3: // Reset the packet, fill it with data so that EntityItem header won't fit, and verify that we don't let it fit { packetData.reset(); int remainingSpace = 10; int almostFullOfData = MAX_OCTREE_UNCOMRESSED_PACKET_SIZE - remainingSpace; QByteArray garbageData(almostFullOfData, 0); packetData.appendValue(garbageData); appendResult = entityItem.appendEntityData(&packetData, params, &modelTreeElementExtraEncodeData); bytesWritten = packetData.getUncompressedSize() - almostFullOfData; if (verbose) { qDebug() << "Test 3: attempt to appendEntityData in nearly full packetData ..."; qDebug() << "appendResult=" << appendResult; qDebug() << "bytesWritten=" << bytesWritten; } QCOMPARE(appendResult, false); QCOMPARE(bytesWritten, 0); } // TEST 4: // Reset the packet, fill it with data so that some of EntityItem won't fit, and verify that we write what can fit { packetData.reset(); int remainingSpace = 50; int almostFullOfData = MAX_OCTREE_UNCOMRESSED_PACKET_SIZE - remainingSpace; QByteArray garbageData(almostFullOfData, 0); packetData.appendValue(garbageData); appendResult = entityItem.appendEntityData(&packetData, params, &modelTreeElementExtraEncodeData); bytesWritten = packetData.getUncompressedSize() - almostFullOfData; if (verbose) { qDebug() << "Test 4: attempt to appendEntityData in nearly full packetData which some should fit ..."; qDebug() << "appendResult=" << appendResult; qDebug() << "bytesWritten=" << bytesWritten; } QCOMPARE(appendResult, true); ReadBitstreamToTreeParams args; EntityItem modelItemFromBuffer; const unsigned char* data = packetData.getUncompressedData() + almostFullOfData; int bytesLeftToRead = packetData.getUncompressedSize() - almostFullOfData; int bytesRead = modelItemFromBuffer.readEntityDataFromBuffer(data, bytesLeftToRead, args); if (verbose) { qDebug() << "Test 5: partial EntityItem written ... bytesRead == bytesWritten..."; qDebug() << "bytesRead=" << bytesRead; qDebug() << "modelItemFromBuffer.getID()=" << modelItemFromBuffer.getID(); qDebug() << "modelItemFromBuffer.getModelURL()=" << modelItemFromBuffer.getModelURL(); } QCOMPARE(bytesRead, bytesWritten); if (verbose) { qDebug() << "Test 6: partial EntityItem written ... getModelURL() NOT SET ..."; } QCOMPARE(modelItemFromBuffer.getModelURL(), ""); } if (verbose) { qDebug() << "******************************************************************************************"; } QCOMPARE(testsPassed, testsTaken); if (verbose) { qDebug() << "******************************************************************************************"; } #endif }