-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Break scene3d test apart into component tests Signed-off-by: Michael Carroll <[email protected]> * Fix include paths Signed-off-by: Michael Carroll <[email protected]> * Remove scene3d as it is deprecated Signed-off-by: Michael Carroll <[email protected]> * Remove message header Signed-off-by: Michael Carroll <[email protected]> * Bump everything to ogre2 by default Signed-off-by: Michael Carroll <[email protected]> * line order Signed-off-by: Louise Poubel <[email protected]> * Fix tests by delaying get render engine calls (#535) --------- Signed-off-by: Ian Chen <[email protected]> * revert default engine Signed-off-by: Ian Chen <[email protected]> * Fix rendering tests (#561) * debugging Signed-off-by: Ian Chen <[email protected]> * reset cam Signed-off-by: Ian Chen <[email protected]> * more testing Signed-off-by: Ian Chen <[email protected]> * no unload Signed-off-by: Ian Chen <[email protected]> * more testing with no unload Signed-off-by: Ian Chen <[email protected]> * unload engine in gzrenderer Signed-off-by: Ian Chen <[email protected]> * unload engine in gzrenderer debugging Signed-off-by: Ian Chen <[email protected]> * unload engine in gzrenderer reset scene Signed-off-by: Ian Chen <[email protected]> * comment out unload Signed-off-by: Ian Chen <[email protected]> * increase timeout Signed-off-by: Ian Chen <[email protected]> * test timing Signed-off-by: Ian Chen <[email protected]> * cleanup Signed-off-by: Ian Chen <[email protected]> * cleanup Signed-off-by: Ian Chen <[email protected]> * more cleanup Signed-off-by: Ian Chen <[email protected]> --------- Signed-off-by: Ian Chen <[email protected]> * Suppress warnings in metal Signed-off-by: Michael Carroll <[email protected]> * Incorrect args Signed-off-by: Michael Carroll <[email protected]> --------- Signed-off-by: Michael Carroll <[email protected]> Signed-off-by: Louise Poubel <[email protected]> Signed-off-by: Ian Chen <[email protected]> Signed-off-by: Michael Carroll <[email protected]> Co-authored-by: Louise Poubel <[email protected]> Co-authored-by: Addisu Z. Taddese <[email protected]> Co-authored-by: Ian Chen <[email protected]>
- Loading branch information
1 parent
5bbfc63
commit c020e25
Showing
8 changed files
with
109 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright (C) 2023 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. | ||
* | ||
*/ | ||
#ifndef GZ_GUI_RENDERENGINEHELPER_HH_ | ||
#define GZ_GUI_RENDERENGINEHELPER_HH_ | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include <gz/rendering/RenderEngine.hh> | ||
#include <gz/rendering/RenderTypes.hh> | ||
|
||
#include "gz/gui/GuiEvents.hh" | ||
|
||
#include "TestHelper.hh" | ||
|
||
namespace gz | ||
{ | ||
namespace gui | ||
{ | ||
namespace testing | ||
{ | ||
/// \brief Get the render engine | ||
/// This function should be called after the main window is | ||
/// shown (mainWindow.show()). It blocks until render events | ||
/// are received. | ||
/// \return A pointer to the render engine or nullptr if it's not available. | ||
static rendering::RenderEngine* getRenderEngine( | ||
const std::string &_engine) | ||
{ | ||
// Filter events | ||
bool receivedPreRenderEvent{false}; | ||
bool receivedRenderEvent{false}; | ||
auto testHelper = std::make_unique<TestHelper>(); | ||
testHelper->forwardEvent = [&](QEvent *_event) | ||
{ | ||
if (_event->type() == gui::events::PreRender::kType) | ||
{ | ||
receivedPreRenderEvent = true; | ||
} | ||
if (_event->type() == gui::events::Render::kType) | ||
{ | ||
receivedRenderEvent = true; | ||
} | ||
}; | ||
|
||
int sleep = 0; | ||
int maxSleep = 30; | ||
while (!receivedRenderEvent && sleep < maxSleep) | ||
{ | ||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); | ||
QCoreApplication::processEvents(); | ||
++sleep; | ||
} | ||
EXPECT_TRUE(receivedPreRenderEvent); | ||
EXPECT_TRUE(receivedRenderEvent); | ||
|
||
// Check scene | ||
auto engine = rendering::engine(_engine); | ||
return engine; | ||
} | ||
} | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters