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
#include "gate/tests.hpp"
#include "gate/io/videosources.hpp"

using namespace gate;
using namespace gate::io;

GATEXX_TEST_UNIT(VideoFrame)
{
    VideoFormat format;
    format.frames_per_second = 30.0f;
    format.width = 640;
    format.height = 480;
    format.bits_per_pixel = 32;

    GATEXX_TEST_CHECK(format.hashCode() != 0);

    {
        const VideoFormat format2(format);
        VideoFormat format3;
        format3 = format2;<--- Variable 'format3' is reassigned a value before the old one has been used.
        format3 = format;<--- Variable 'format3' is reassigned a value before the old one has been used.
        GATEXX_TEST_CHECK_EQUAL(format.encoding_id, format3.encoding_id);
        GATEXX_TEST_CHECK_EQUAL(format.compression, format3.compression);
        GATEXX_TEST_CHECK_EQUAL(format.frames_per_second, format3.frames_per_second);
        GATEXX_TEST_CHECK_EQUAL(format.width, format3.width);
        GATEXX_TEST_CHECK_EQUAL(format.height, format3.height);
        GATEXX_TEST_CHECK_EQUAL(format.bits_per_pixel, format3.bits_per_pixel);
    }

    VideoFrame frame(format);
    GATEXX_TEST_CHECK(frame.c_impl() != NULL);
    GATEXX_TEST_CHECK_NOTHROW(frame.getFormat());
    GATEXX_TEST_CHECK_NOTHROW(frame.getImage());
    GATEXX_TEST_CHECK_NOTHROW(frame.getRecordTime());

    {
        VideoFrame frame2(frame);
        VideoFrame frame3(format);
        frame3 = frame2;
        GATEXX_TEST_CHECK_EQUAL(frame3.getFormat().hashCode(), frame.getFormat().hashCode());
    }
}

GATEXX_TEST_UNIT(VideoSource)
{
    Array<VideoSource> sources;
    GATEXX_TRY_IGNORE(sources = VideoSources::enumSources());

    GATEXX_ENUMERATE(const VideoSource, source, sources.enumerate())
    {
        GATEXX_TEST_CHECK(source->c_impl() != NULL);
    }
}

GATEXX_TEST_UNIT(VideoScreenControl)
{
    GATEXX_TRY_IGNORE(
        VideoScreenControl control;
        control.c_impl();
    )
}