def testExceptionIfOverlaysAndDepthOrSegmentation(self): overlay = engine.TextOverlay() with self.assertRaisesWithLiteralMatch( ValueError, engine._OVERLAYS_NOT_SUPPORTED_FOR_DEPTH_OR_SEGMENTATION): self._physics.render(depth=True, overlays=[overlay]) with self.assertRaisesWithLiteralMatch( ValueError, engine._OVERLAYS_NOT_SUPPORTED_FOR_DEPTH_OR_SEGMENTATION): self._physics.render(segmentation=True, overlays=[overlay])
def testTextOverlay(self): height, width = 480, 640 overlay = engine.TextOverlay(title='Title', body='Body', style='big', position='bottom right') no_overlay = self._physics.render(height, width, camera_id=0) with_overlay = self._physics.render(height, width, camera_id=0, overlays=[overlay]) self.assertFalse(np.all(no_overlay == with_overlay), msg='Images are identical with and without text overlay.')