File: utils_test.cpp

package info (click to toggle)
sight 25.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 42,184 kB
  • sloc: cpp: 289,476; xml: 17,257; ansic: 9,878; python: 1,379; sh: 144; makefile: 33
file content (74 lines) | stat: -rw-r--r-- 2,694 bytes parent folder | download | duplicates (2)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/************************************************************************
 *
 * Copyright (C) 2009-2023 IRCAD France
 * Copyright (C) 2012-2017 IHU Strasbourg
 *
 * This file is part of Sight.
 *
 * Sight is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Sight is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with Sight. If not, see <https://www.gnu.org/licenses/>.
 *
 ***********************************************************************/

#include "utils_test.hpp"

#include "../../../../../module/ui/viz/helper/utils.hpp"

// Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION(sight::module::ui::viz::ut::utils_test);

namespace sight::module::ui::viz::ut
{

//------------------------------------------------------------------------------

void utils_test::setUp()
{
}

//------------------------------------------------------------------------------

void utils_test::tearDown()
{
}

//------------------------------------------------------------------------------

void utils_test::convert_ogre_color_to_q_color()
{
    QColor ref_color(255, 255, 255);

    QColor result_color = module::ui::viz::helper::utils::convert_ogre_color_to_q_color(Ogre::ColourValue());
    CPPUNIT_ASSERT(result_color.red() == ref_color.red());
    CPPUNIT_ASSERT(result_color.green() == ref_color.green());
    CPPUNIT_ASSERT(result_color.blue() == ref_color.blue());
    CPPUNIT_ASSERT(result_color.alpha() == ref_color.alpha());
}

//------------------------------------------------------------------------------

void utils_test::convert_q_color_to_ogre_color()
{
    Ogre::ColourValue ref_color;

    Ogre::ColourValue result_color =
        module::ui::viz::helper::utils::convert_q_color_to_ogre_color(QColor(255, 255, 255));
    CPPUNIT_ASSERT(static_cast<int>(result_color.r) == static_cast<int>(ref_color.r));
    CPPUNIT_ASSERT(static_cast<int>(result_color.g) == static_cast<int>(ref_color.g));
    CPPUNIT_ASSERT(static_cast<int>(result_color.b) == static_cast<int>(ref_color.b));
    CPPUNIT_ASSERT(static_cast<int>(result_color.a) == static_cast<int>(ref_color.a));
}

//------------------------------------------------------------------------------

} // namespace sight::module::ui::viz::ut