diff --git a/examples/worlds/camera_lens_flare.sdf b/examples/worlds/camera_lens_flare.sdf
index e9f46268b6c..665126defe0 100644
--- a/examples/worlds/camera_lens_flare.sdf
+++ b/examples/worlds/camera_lens_flare.sdf
@@ -346,7 +346,7 @@
-
+
@@ -384,10 +384,10 @@
name="gz::sim::systems::LensFlare">
0.5
3 3 3
-
+
-
\ No newline at end of file
+
diff --git a/test/integration/camera_lens_flare.cc b/test/integration/camera_lens_flare.cc
new file mode 100644
index 00000000000..8a02e96f1ac
--- /dev/null
+++ b/test/integration/camera_lens_flare.cc
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2022 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include
+
+#ifdef _MSC_VER
+#pragma warning(push, 0)
+#endif
+#include
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#include "gz/sim/Server.hh"
+#include "test_config.hh"
+#include
+#include
+#include
+#include
+#include
+
+#include "plugins/MockSystem.hh"
+#include "../helpers/EnvTestFixture.hh"
+
+using namespace gz;
+using namespace sim;
+using namespace std::chrono_literals;
+
+/// \brief Test LensFlare system
+class LensFlareTest : public InternalFixture<::testing::Test>
+{
+};
+
+std::mutex mutex;
+msgs::Image imageMsg;
+unsigned char *imageBuffer = nullptr;
+
+/////////////////////////////////////////////////
+void imageCb(const msgs::Image &_msg)
+{
+ ASSERT_EQ(msgs::PixelFormatType::RGB_INT8,
+ _msg.pixel_format_type());
+
+ // Add the frame to image buffer
+ mutex.lock();
+ unsigned int imageSamples = _msg.width() * _msg.height() * 3;
+
+ if (!imageBuffer)
+ imageBuffer = new unsigned char[imageSamples];
+ memcpy(imageBuffer, _msg.data().c_str(), imageSamples);
+ mutex.unlock();
+}
+
+/////////////////////////////////////////////////
+// The test checks the Camera with Lens Flare
+TEST_F(LensFlareTest,
+ GZ_UTILS_TEST_DISABLED_ON_MAC(LensFlareTest))
+{
+ // Start server
+ ServerConfig serverConfig;
+ const auto sdfFile = common::joinPaths(std::string(PROJECT_SOURCE_PATH),
+ "test", "worlds", "camera_lens_flare.sdf");
+ serverConfig.SetSdfFile(sdfFile);
+
+ Server server(serverConfig);
+ EXPECT_FALSE(server.Running());
+ EXPECT_FALSE(*server.Running(0));
+
+ // Subscribe to the image topic
+ transport::Node node;
+ node.Subscribe("/camera_lens_flare", &imageCb);
+
+ // Run server and verify that we are receiving a message
+ // from the camera with lens flare
+ size_t iters100 = 100u;
+ server.Run(true, iters100, false);
+
+ int sleep{0};
+ int maxSleep{30};
+ while (imageBuffer == nullptr && sleep < maxSleep)
+ {
+ std::this_thread::sleep_for(100ms);
+ sleep++;
+ }
+ EXPECT_LT(sleep, maxSleep);
+ ASSERT_NE(imageBuffer, nullptr);
+
+ delete[] imageBuffer;
+}
diff --git a/test/worlds/camera_lens_flare.sdf b/test/worlds/camera_lens_flare.sdf
new file mode 100644
index 00000000000..01d7c660693
--- /dev/null
+++ b/test/worlds/camera_lens_flare.sdf
@@ -0,0 +1,124 @@
+
+
+
+
+ 0.001
+ 1.0
+
+
+
+
+
+
+ ogre
+ 0 0 0 1
+
+
+
+ true
+ 0.5 0.5 0.5 1
+ 0.5 0.5 0.5 1
+ 0.0 0.0 -1.0
+
+
+
+ true
+ 3 0 -0.5 0 0 0
+
+
+
+
+ 5 8
+
+
+
+
+
+
+ 5 8
+
+
+
+ 0.5 0.5 0.5 1
+ 0.8 0.8 0.8 1
+
+
+
+
+
+
+ 1
+ 0 0 0 0 0.0 0
+
+
+
+
+ 0.1 0.1 0.1
+
+
+
+
+ 1
+
+ 0.927295218
+
+ 320
+ 240
+ R8G8B8
+
+
+ 0.1
+ 100
+
+
+ 1
+ 30
+ camera_normal
+
+
+
+
+
+ 1
+ 0 0 0 0 0.0 0
+
+
+
+
+ 0.1 0.1 0.1
+
+
+
+
+ 1
+
+ 0.927295218
+
+ 320
+ 240
+ R8G8B8
+
+
+ 0.1
+ 100
+
+
+ 1
+ 30
+ camera_lens_flare
+
+
+
+
+
+
+
+