File: tst_qffmpegmath.cpp

package info (click to toggle)
qt6-multimedia 6.10.2-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 43,900 kB
  • sloc: cpp: 186,273; ansic: 78,309; java: 2,870; python: 262; xml: 193; sh: 136; makefile: 30
file content (31 lines) | stat: -rw-r--r-- 792 bytes parent folder | download
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
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include <QtTest/qtest.h>
#include <QtCore/qobject.h>
#include <QtFFmpegMediaPluginImpl/private/qffmpeg_p.h>

extern "C" {
#include "libavutil/mathematics.h"
}

QT_USE_NAMESPACE

class tst_qffmpegmath : public QObject
{
    Q_OBJECT

private slots:
    void mul_agreesWith_av_rescale_withFiniteNumbers() {
        for (qint64 number = -20; number < 30; ++number) {
            const std::optional<qint64> actual = QFFmpeg::mul(number, AVRational{ 1, 10 });
            QVERIFY(actual);
            const qint64 expected = av_rescale(number, 1, 10);
            QCOMPARE_EQ(actual, expected);
        }
    }
};

QTEST_GUILESS_MAIN(tst_qffmpegmath)

#include "tst_qffmpegmath.moc"