1 #include <gtest/gtest.h>
2 #include <gmock/gmock.h>
4 #include <ModelHighAPI_Selection.h>
6 #include <MockModelAPI_AttributeSelection.h>
9 using ::testing::Return;
10 using ::testing::ReturnRefOfCopy;
11 using ::testing::Test;
13 // TODO(spo): should be common function
14 static void null_deleter(void *) {}
16 class HighModelAPI_Selection_Test : public Test {
18 MockModelAPI_AttributeSelection aMockAttributeSelection;
19 std::shared_ptr<ModelAPI_AttributeSelection> anAttributeSelection;
21 HighModelAPI_Selection_Test() {
22 anAttributeSelection = std::shared_ptr<ModelAPI_AttributeSelection>(&aMockAttributeSelection, &null_deleter);
25 ~HighModelAPI_Selection_Test() {
29 TEST_F(HighModelAPI_Selection_Test, Default) {
30 ModelHighAPI_Selection aValue;
32 EXPECT_CALL(aMockAttributeSelection, setValue(_, _, false));
34 aValue.fillAttribute(anAttributeSelection);
37 TEST_F(HighModelAPI_Selection_Test, ResultAndSubShape) {
38 std::shared_ptr<ModelAPI_Result> aResult;
39 std::shared_ptr<GeomAPI_Shape> aShape;
40 ModelHighAPI_Selection aValue(aResult, aShape);
42 EXPECT_CALL(aMockAttributeSelection, setValue(_, _, false));
44 aValue.fillAttribute(anAttributeSelection);
47 TEST_F(HighModelAPI_Selection_Test, TypeAndSubShapeName) {
48 ModelHighAPI_Selection aValue("Type", "SubShapeName");
50 EXPECT_CALL(aMockAttributeSelection, selectSubShape("Type", "SubShapeName"));
52 aValue.fillAttribute(anAttributeSelection);