summaryrefslogtreecommitdiffstats
path: root/testfiles/src/sp-item-group-test.cpp
blob: 3439f54940ca75f438207fd2c742a5ff759e21ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
 * SPGroup test
 *//*
 * Authors: see git history
 *
 * Copyright (C) 2020 Authors
 *
 * Released under GNU GPL version 2 or later, read the file 'COPYING' for more information
 */

#include <gtest/gtest.h>
#include <src/document.h>
#include <src/inkscape.h>
#include <src/live_effects/effect.h>
#include <src/object/sp-lpe-item.h>

using namespace Inkscape;
using namespace Inkscape::LivePathEffect;

class SPGroupTest : public ::testing::Test {
  protected:
    void SetUp() override
    {
        // setup hidden dependency
        Application::create(false);
    }
};

TEST_F(SPGroupTest, applyingPowerClipEffectToGroupWithoutClipIsIgnored)
{
    std::string svg("\
<svg width='100' height='100'>\
    <g id='group1'>\
        <rect id='rect1' width='100' height='50' />\
        <rect id='rect2' y='50' width='100' height='50' />\
    </g>\
</svg>");

    SPDocument *doc = SPDocument::createNewDocFromMem(svg.c_str(), svg.size(), true);

    auto group = dynamic_cast<SPGroup *>(doc->getObjectById("group1"));
    Effect::createAndApply(POWERCLIP, doc, group);

    ASSERT_FALSE(group->hasPathEffect());
}