-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// clang-format off | ||
// SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> | ||
// clang-format on | ||
// SPDX-FileContributor: Laurent Montel <laurent.montel@kdab.com> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
#pragma once | ||
|
||
#include <QtGui/QFontMetrics> | ||
#include <QtGui/QFont> | ||
#include <QtTest/QTest> | ||
|
||
#include "cxx-qt-gen/qfontmetrics.cxx.h" | ||
|
||
class QFontMetricsTest : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
private Q_SLOTS: | ||
void construct() | ||
{ | ||
} | ||
void clone() | ||
{ | ||
QFont f; | ||
f.setBold(true); | ||
f.setPointSize(30); | ||
const auto m = QFontMetrics(f); | ||
|
||
const auto c = clone_qfontmetrics(m); | ||
QCOMPARE(m.ascent(), c.ascent()); | ||
QCOMPARE(m.height(), c.height()); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> | ||
// SPDX-FileContributor: Laurent Montel <laurent.montel@kdab.com> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
use cxx_qt_lib::QFontMetrics; | ||
|
||
#[cxx::bridge] | ||
mod qfontmetrics_cxx { | ||
unsafe extern "C++" { | ||
include!("cxx-qt-lib/qfontmetrics.h"); | ||
|
||
type QFontMetrics = cxx_qt_lib::QFontMetrics; | ||
} | ||
|
||
extern "Rust" { | ||
fn clone_qfontmetrics(f: &QFontMetrics) -> QFontMetrics; | ||
} | ||
} | ||
|
||
fn clone_qfontmetrics(p: &QFontMetrics) -> QFontMetrics { | ||
p.clone() | ||
} |