GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_slider_travel_get.c Lines: 12 12 100.0 %
Date: 2024-12-05 08:52:37 Branches: 22 22 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 *
4
 * This program and the accompanying materials are made available under the
5
 * terms of the MIT License which is available at
6
 * https://opensource.org/licenses/MIT.
7
 *
8
 * SPDX-License-Identifier: MIT
9
 **************************************************************************/
10
11
12
/**************************************************************************/
13
/**************************************************************************/
14
/**                                                                       */
15
/** GUIX Component                                                        */
16
/**                                                                       */
17
/**   Prompt Management (Slider)                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
/* Include necessary system files.  */
24
25
#include "gx_api.h"
26
#include "gx_slider.h"
27
28
/* Bring in externs for caller checking code.  */
29
GX_CALLER_CHECKING_EXTERNS
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gxe_slider_travel_get                              PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function checks for errors in slider travel get call.          */
44
/*                                                                        */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    slider                                Slider widget control block   */
49
/*    info                                  Pointer to slider info        */
50
/*                                            structure                   */
51
/*    return_min_travel                     Pointer to destination for    */
52
/*                                            for minimum travel value    */
53
/*    return_max_travel                     Pointer to destination for    */
54
/*                                            for maximum travel value    */
55
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    status                                Completion status             */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    _gx_slider_travel_get                 Actual slider travel get      */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/*  RELEASE HISTORY                                                       */
69
/*                                                                        */
70
/*    DATE              NAME                      DESCRIPTION             */
71
/*                                                                        */
72
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
73
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
74
/*                                            resulting in version 6.1    */
75
/*                                                                        */
76
/**************************************************************************/
77
17
UINT _gxe_slider_travel_get(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT *return_min_travel, INT *return_max_travel)
78
{
79
UINT status;
80
81
    /* Check for invalid caller.  */
82

17
    GX_INIT_AND_THREADS_CALLER_CHECKING
83
84
    /* Check for invalid pointer.  */
85


15
    if ((slider == GX_NULL) || (info == GX_NULL) || (return_min_travel == GX_NULL) || (return_max_travel == GX_NULL))
86
    {
87
5
        return(GX_PTR_ERROR);
88
    }
89
90
    /* Check for invalid widget.  */
91
10
    if (slider -> gx_widget_type == 0)
92
    {
93
1
        return(GX_INVALID_WIDGET);
94
    }
95
96
    /* Check for invalid slider info.  */
97
9
    if ((info -> gx_slider_info_current_val < info -> gx_slider_info_min_val) ||
98
8
        (info -> gx_slider_info_current_val > info -> gx_slider_info_max_val) ||
99
7
        (info -> gx_slider_info_min_val >= info -> gx_slider_info_max_val))
100
    {
101
3
        return(GX_INVALID_VALUE);
102
    }
103
104
    /* Call actual slider travel get.  */
105
6
    status = _gx_slider_travel_get(slider, info, return_min_travel, return_max_travel);
106
107
6
    return(status);
108
}
109