Check changed signal
parent
25d65e1b9e
commit
12e6eaceb8
|
@ -1,5 +1,6 @@
|
||||||
#include "test_object_rust.h"
|
#include "test_object_rust.h"
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
#include <QSignalSpy>
|
||||||
|
|
||||||
class TestRustObject : public QObject
|
class TestRustObject : public QObject
|
||||||
{
|
{
|
||||||
|
@ -23,8 +24,16 @@ void TestRustObject::testStringGetter()
|
||||||
|
|
||||||
void TestRustObject::testStringSetter()
|
void TestRustObject::testStringSetter()
|
||||||
{
|
{
|
||||||
|
// GIVEN
|
||||||
Person person;
|
Person person;
|
||||||
|
QSignalSpy spy(&person, &Person::userNameChanged);
|
||||||
|
|
||||||
|
// WHEN
|
||||||
person.setUserName("Konqi");
|
person.setUserName("Konqi");
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
QVERIFY(spy.isValid());
|
||||||
|
QCOMPARE(spy.count(), 1);
|
||||||
QCOMPARE(person.userName(), QString("Konqi"));
|
QCOMPARE(person.userName(), QString("Konqi"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue