1
0
mirror of https://github.com/thp/pyotherside.git synced 2025-01-17 23:22:53 +08:00

Test for >32 bit integer conversion

This commit is contained in:
Thomas Perl 2017-10-14 12:04:29 +02:00
parent fdb5950acd
commit 9f34fea606
2 changed files with 13 additions and 0 deletions

View File

@ -334,3 +334,15 @@ TestPyOtherSide::testSetToList()
QVERIFY(l.contains(321));
QVERIFY(l.contains(444));
}
void
TestPyOtherSide::testIntMoreThan32Bits()
{
// See https://github.com/thp/pyotherside/issues/86
// Affected: Devices and OSes where long is 32 bits, but long long is 64 bits
long long two_fortytwo = 4398046511104LL;
PyObject *o = PyLong_FromLongLong(two_fortytwo);
QVERIFY(o);
QVariant v = convertPyObjectToQVariant(o);
QVERIFY(v.toLongLong() == two_fortytwo);
}

View File

@ -39,6 +39,7 @@ class TestPyOtherSide : public QObject {
void testQObjectRef();
void testConvertToPythonAndBack();
void testSetToList();
void testIntMoreThan32Bits();
};
#endif /* PYOTHERSIDE_TESTS_H */