16c65fc226
No longer returning KLocalizedContex when initializing from QQmlEngine. Unique Pointer was causing errors.
36 lines
839 B
Rust
36 lines
839 B
Rust
use ki18n::klocalizedcontext::KLocalizedContext;
|
|
use qttypes::QString;
|
|
|
|
#[cfg(feature = "qmetaobject")]
|
|
use qmetaobject::QmlEngine;
|
|
|
|
mod common;
|
|
|
|
#[test]
|
|
#[cfg(feature = "qmetaobject")]
|
|
fn cpp_ptr() {
|
|
let _lock = common::lock_for_test();
|
|
|
|
let engine = QmlEngine::new();
|
|
let context = KLocalizedContext::default();
|
|
|
|
let context_ptr = context.cpp_ptr();
|
|
assert_ne!(std::ptr::null(), context_ptr);
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(feature = "qmetaobject")]
|
|
fn translation_domain() {
|
|
let _lock = common::lock_for_test();
|
|
|
|
let engine = QmlEngine::new();
|
|
let mut context = KLocalizedContext::default();
|
|
|
|
const TRANSLATION_DOMAIN: &str = "Test Domain";
|
|
context.set_translation_domain(TRANSLATION_DOMAIN.into());
|
|
|
|
let domain = context.translation_domain();
|
|
|
|
assert_eq!(domain, QString::from(TRANSLATION_DOMAIN));
|
|
}
|