File: iv_imagerenderer_test.cc

package info (click to toggle)
gnome-commander 1.18.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,796 kB
  • sloc: cpp: 44,542; xml: 3,929; lex: 600; sh: 80; makefile: 13
file content (53 lines) | stat: -rw-r--r-- 2,115 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
/**
 * @file iv_imagerenderer_test.cc
 * @brief Part of GNOME Commander - A GNOME based file manager
 * 
 * @details In this single test the creation of a gtk widget is tested
 * in which two elements are visualized. It is not to be considered to
 * be a unit test, as individual functions are not fully tested!
 *
 * @copyright (C) 2006 Assaf Gordon\n
 * @copyright (C) 2007-2012 Piotr Eljasiak\n
 * @copyright (C) 2013-2024 Uwe Scholz\n
 *
 * @copyright This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * @copyright This program 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 General Public License for more details.
 *
 * @copyright You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include <libgviewer.h>
#include "gtest/gtest.h"

class ImageRendererBestFitTest : public ::testing::TestWithParam<bool> {};

INSTANTIATE_TEST_CASE_P(InstantiationName,
                        ImageRendererBestFitTest,
                        ::testing::Bool());

TEST_P(ImageRendererBestFitTest, image_renderer_set_best_fit_test) {
    GtkWidget *imgr;
    imgr = image_render_new();
    image_render_set_best_fit(IMAGE_RENDER(imgr),GetParam());
    ASSERT_EQ(GetParam(), image_render_get_best_fit(IMAGE_RENDER(imgr)));
}

////////////////////////////////////////////////////////////////////////

class ImageRendererScaleFactorTest : public ::testing::Test {};

TEST_F(ImageRendererScaleFactorTest, image_renderer_set_scale_factor_test) {
    GtkWidget *imgr;
    imgr = image_render_new();
    image_render_set_scale_factor(IMAGE_RENDER(imgr), 1);
    ASSERT_EQ(1, image_render_get_scale_factor(IMAGE_RENDER(imgr)));
}