Skip to content
Snippets Groups Projects
Commit eca2f5dc authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rm triv test, and move fct to anon namespace

parent eb4b3ae0
No related branches found
No related tags found
1 merge request!918rename and simplify in GUI/Core conversion
...@@ -119,10 +119,7 @@ std::unique_ptr<Layer> buildLayer(const LayerItem& item) ...@@ -119,10 +119,7 @@ std::unique_ptr<Layer> buildLayer(const LayerItem& item)
return P_layer; return P_layer;
} }
} // namespace std::unique_ptr<LayerRoughness> itemToLayerRoughness(LayerBasicRoughnessItem* roughness)
std::unique_ptr<LayerRoughness>
GUI::Transform::ToDomain::itemToLayerRoughness(LayerBasicRoughnessItem* roughness)
{ {
if (!roughness) if (!roughness)
return nullptr; return nullptr;
...@@ -130,6 +127,8 @@ GUI::Transform::ToDomain::itemToLayerRoughness(LayerBasicRoughnessItem* roughnes ...@@ -130,6 +127,8 @@ GUI::Transform::ToDomain::itemToLayerRoughness(LayerBasicRoughnessItem* roughnes
roughness->lateralCorrelationLength()); roughness->lateralCorrelationLength());
} }
} // namespace
std::unique_ptr<MultiLayer> GUI::Transform::ToDomain::itemToSample(const MultiLayerItem& sampleItem) std::unique_ptr<MultiLayer> GUI::Transform::ToDomain::itemToSample(const MultiLayerItem& sampleItem)
{ {
auto P_sample = createMultiLayer(sampleItem); auto P_sample = createMultiLayer(sampleItem);
......
...@@ -26,8 +26,6 @@ class LayerRoughness; ...@@ -26,8 +26,6 @@ class LayerRoughness;
namespace GUI::Transform::ToDomain { namespace GUI::Transform::ToDomain {
std::unique_ptr<LayerRoughness> itemToLayerRoughness(LayerBasicRoughnessItem* roughness);
std::unique_ptr<MultiLayer> itemToSample(const MultiLayerItem& item); std::unique_ptr<MultiLayer> itemToSample(const MultiLayerItem& item);
} // namespace GUI::Transform::ToDomain } // namespace GUI::Transform::ToDomain
......
#include "GUI/Model/Descriptor/DoubleDescriptor.h"
#include "GUI/Model/FromDomain/FromDomain.h"
#include "GUI/Model/Sample/LayerRoughnessItems.h"
#include "GUI/Model/ToDomain/ToDomain.h"
#include "Sample/Interface/LayerRoughness.h"
#include "Tests/GTestWrapper/google_test.h"
class TestLayerRoughnessItems : public ::testing::Test {
};
TEST_F(TestLayerRoughnessItems, LayerRoughnessToDomain)
{
LayerBasicRoughnessItem roughnessItem;
roughnessItem.sigma().set(10.0);
roughnessItem.hurst().set(20.0);
roughnessItem.lateralCorrelationLength().set(30.0);
auto P_roughness = GUI::Transform::ToDomain::itemToLayerRoughness(&roughnessItem);
EXPECT_EQ(P_roughness->sigma(), roughnessItem.sigma());
EXPECT_EQ(P_roughness->hurst(), roughnessItem.hurst());
EXPECT_EQ(P_roughness->lateralCorrLength(), roughnessItem.lateralCorrelationLength());
// No roughness
EXPECT_TRUE(GUI::Transform::ToDomain::itemToLayerRoughness(nullptr) == nullptr);
}
TEST_F(TestLayerRoughnessItems, LayerRoughnessFromDomain)
{
LayerRoughness roughness(10.0, 20.0, 30.0);
LayerBasicRoughnessItem roughnessItem;
GUI::Transform::FromDomain::setRoughnessItem(&roughnessItem, roughness);
EXPECT_EQ(roughness.sigma(), roughnessItem.sigma());
EXPECT_EQ(roughness.hurst(), roughnessItem.hurst());
EXPECT_EQ(roughness.lateralCorrLength(), roughnessItem.lateralCorrelationLength());
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment