TEST(SCENE_SEGMENTER_TEST_NODE, TestTableSceneSegmentation) { scene_segmenter_node_test::TestSceneSegmenterNode test_node = buildTestNode(); sensor_msgs::PointCloud2 scene = buildTestScene(); test_node.scenePublisher.publish(scene); double startTimeInSeconds =ros::Time::now().toSec(); while(!test_node.hasReceivedMessage) { ros::spinOnce(); double currentTimeInSeconds =ros::Time::now().toSec(); //we should have received a message by now, something is wrong. if(currentTimeInSeconds-startTimeInSeconds > 5) { break; } } EXPECT_EQ(test_node.hasReceivedMessage, true); EXPECT_EQ(test_node.sizeOfReceivedSegmentedObjectList, 5); }
void checkRunRendererRunning() { // GIVEN Qt3DRender::Render::FilterCompatibleTechniqueJob backendFilterCompatibleTechniqueJob; Qt3DRender::TestAspect testAspect(buildTestScene()); // WHEN Qt3DRender::Render::NodeManagers *nodeManagers = testAspect.nodeManagers(); QVERIFY(nodeManagers); Qt3DRender::Render::TechniqueManager *techniqueManager = nodeManagers->techniqueManager(); QVERIFY(techniqueManager); backendFilterCompatibleTechniqueJob.setManager(techniqueManager); backendFilterCompatibleTechniqueJob.setRenderer(testAspect.renderer()); testAspect.initializeRenderer(); // THEN QCOMPARE(testAspect.renderer()->isRunning(), true); QCOMPARE(testAspect.renderer()->graphicsContext()->isInitialized(), true); const QVector<Qt3DRender::Render::HTechnique> handles = testAspect.nodeManagers()->techniqueManager()->activeHandles(); QCOMPARE(handles.size(), 3); // WHEN backendFilterCompatibleTechniqueJob.run(); // THEN -> empty if job ran properly const QVector<Qt3DCore::QNodeId> dirtyTechniquesId = testAspect.nodeManagers()->techniqueManager()->takeDirtyTechniques(); QCOMPARE(dirtyTechniquesId.size(), 0); // Check at least one technique is valid bool foundValid = false; for (const auto handle: handles) { Qt3DRender::Render::Technique *technique = testAspect.nodeManagers()->techniqueManager()->data(handle); foundValid |= technique->isCompatibleWithRenderer(); } QCOMPARE(foundValid, true); }