Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement facelist property #237

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d2ef593
implement FaceProperty
Mar 29, 2022
955b285
Add FaceList type
Mar 11, 2022
062d558
Implement FaceListProperty
Mar 11, 2022
e94742b
add FaceListPropertyWidget skeleton
Mar 11, 2022
54e1586
StyleTag has face list property
Mar 11, 2022
8c48b95
minor style fixes
Mar 11, 2022
8a69d7c
Throw instead of assert-fail in a rare condition
Mar 11, 2022
d54edb1
More consistent property widgets code style
Mar 11, 2022
930b414
Move joint-point aware PathPoint-equality to PathPoint class
Mar 12, 2022
bf795be
Delay conversion of faces to QPainterPath
Mar 12, 2022
e2ea135
simplify FaceListWidget
Mar 13, 2022
0621b50
Face selection mode
Mar 13, 2022
8dbe5d0
remove no longer required code
Mar 13, 2022
319bd04
hover faces
Mar 14, 2022
c53cce5
Merge branch 'implement-faces-property' into implement-facelist-property
Apr 1, 2022
30da911
fix Face list type label confusion
Apr 2, 2022
1ae4ef6
don't overwrite old scene file if serialization fails (only JSON)
Apr 2, 2022
54cd3aa
guard ::contains function with requires-expression
Apr 3, 2022
a501209
fix PathPoint::is_dangling implementation
Apr 3, 2022
6e7a664
add compile option DRAW_POINT_IDS
Apr 7, 2022
edcf5cf
rename PathVector::outline to to_painter_path
Apr 7, 2022
133e298
add Path::to_painter_path method
Apr 7, 2022
9cc12cb
add PathVector::draw_point_ids(QPainter&)
Apr 7, 2022
4a40b28
simplify testutil::Application
Apr 7, 2022
fb15a8c
Graph::faces returns a set instead of a vector
Apr 7, 2022
d5b4234
fix missing const
Apr 7, 2022
96bbb27
provide another (failing) face detection test case
Apr 7, 2022
41487f7
fix Face::contains
Apr 7, 2022
1b33f3b
improve face selection
Apr 7, 2022
789fe54
remove ambiguous Face operator== and operator<
Apr 8, 2022
3661fb6
disable FaceDetection tests because they are known to be broken
Apr 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify testutil::Application
don't expect options parameter, options are the same for all tests.
  • Loading branch information
Pascal Bies committed Apr 7, 2022
commit 4a40b28b3ca061b84649ed11bd67f95b28622383
14 changes: 1 addition & 13 deletions test/unit/converttest.cpp
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
#include "external/json.hpp"
#include "gtest/gtest.h"
#include "main/application.h"
#include "main/options.h"
#include "mainwindow/pathactions.h"
#include "objects/ellipse.h"
#include "objects/pathobject.h"
@@ -14,21 +13,10 @@
#include "scene/disjointpathpointsetforest.h"
#include "testutil.h"

namespace
{

std::unique_ptr<omm::Options> options()
{
return std::make_unique<omm::Options>(false, // is_cli
false // have_opengl
);
}

} // namespace

TEST(convert, ellipse)
{
ommtest::Application test_app(::options());
ommtest::Application test_app;
auto& app = test_app.omm_app();

auto& e = app.insert_object(omm::Ellipse::TYPE, omm::Application::InsertionMode::Default);
9 changes: 1 addition & 8 deletions test/unit/icon.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "config.h"
#include "gtest/gtest.h"
#include "main/application.h"
#include "main/options.h"
#include "mainwindow/exporter.h"
#include "objects/view.h"
#include "scene/scene.h"
@@ -20,11 +19,6 @@ class NonUniqueException : public std::runtime_error
using std::runtime_error::runtime_error;
};

auto options()
{
return std::make_unique<omm::Options>(false, false);
}

auto& find_unique_item(omm::Scene& scene, const QString& name)
{
const auto items = scene.find_items<omm::Object>(name);
@@ -76,8 +70,7 @@ class Icon : public ::testing::TestWithParam<IconTestParameter>
{
protected:
Icon()
: m_app(ommtest::Application(options()))
, m_scene(*m_app.omm_app().scene)
: m_scene(*m_app.omm_app().scene)
{
}

11 changes: 1 addition & 10 deletions test/unit/nodetest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "gtest/gtest.h"
#include "main/application.h"
#include "main/options.h"
#include "nodesystem/nodecompilerglsl.h"
#include "nodesystem/nodecompilerpython.h"
#include "nodesystem/nodemodel.h"
@@ -21,20 +20,12 @@
namespace
{

std::unique_ptr<omm::Options> options()
{
return std::make_unique<omm::Options>(false, // is_cli
false // have_opengl
);
}

template<typename Compiler>
class NodeTestFixture
{
public:
NodeTestFixture()
: m_q_app(options())
, m_model(omm::nodes::NodeModel(Compiler::LANGUAGE, m_q_app.omm_app().scene.get()))
: m_model(omm::nodes::NodeModel(Compiler::LANGUAGE, m_q_app.omm_app().scene.get()))
, m_compiler(m_model)
{
}
14 changes: 3 additions & 11 deletions test/unit/serialization.cpp
Original file line number Diff line number Diff line change
@@ -19,13 +19,6 @@
namespace
{

std::unique_ptr<omm::Options> options()
{
return std::make_unique<omm::Options>(false, // is_cli
false // have_opengl
);
}

bool scene_eq(const nlohmann::json& a, const nlohmann::json& b)
{
static constexpr auto object_t = nlohmann::detail::value_t::object;
@@ -138,15 +131,15 @@ TEST(serialization, SceneEq)

TEST(serialization, JSONInvalidScene)
{
ommtest::Application qt_app{options()};
ommtest::Application qt_app;
nlohmann::json json_file;
omm::serialization::JSONDeserializer deserializer(json_file);
EXPECT_FALSE(omm::SceneSerialization{*qt_app.omm_app().scene}.load(deserializer));
}

TEST(serialization, BinaryInvalidScene)
{
ommtest::Application qt_app{options()};
ommtest::Application qt_app;
nlohmann::json json_file;
omm::serialization::JSONDeserializer deserializer(json_file);
EXPECT_FALSE(omm::SceneSerialization{*qt_app.omm_app().scene}.load(deserializer));
@@ -221,8 +214,7 @@ class SceneFromFileInvariance : public testing::TestWithParam<QString>
{
protected:
SceneFromFileInvariance()
: m_app(ommtest::Application(options()))
, m_scene(*m_app.omm_app().scene)
: m_scene(*m_app.omm_app().scene)
{
}

16 changes: 14 additions & 2 deletions test/unit/testutil.cpp
Original file line number Diff line number Diff line change
@@ -6,12 +6,24 @@
#include <QProcessEnvironment>
#include <QTimer>

namespace
{

std::unique_ptr<omm::Options> options()
{
return std::make_unique<omm::Options>(false, // is_cli
false // have_opengl
);
}

} // namespace

namespace ommtest
{

Application::Application(std::unique_ptr<omm::Options> options)
Application::Application()
: m_q_application(argc, argv.data())
, m_omm_application(std::make_unique<omm::Application>(m_q_application, std::move(options)))
, m_omm_application(std::make_unique<omm::Application>(m_q_application, options()))
{
}

2 changes: 1 addition & 1 deletion test/unit/testutil.h
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ std::vector<char*> string_array_to_charpp(std::array<std::string, N>& string_arr
class Application
{
public:
explicit Application(std::unique_ptr<omm::Options> options);
explicit Application();
~Application();
omm::Application& omm_app() const;