diff --git a/protocols/qq/qqprotocol.cpp b/protocols/qq/qqprotocol.cpp --- a/protocols/qq/qqprotocol.cpp +++ b/protocols/qq/qqprotocol.cpp @@ -47,7 +47,7 @@ propStreet(QStringLiteral("QQVCardAddress"), i18n("Home Address"), QString(), Kopete::PropertyTmpl::PersistentProperty ), propZipcode(QStringLiteral("QQVCardZipcode"), i18n("Zipcode"), QString(), Kopete::PropertyTmpl::PersistentProperty ), propAge(QStringLiteral("QQVCardAge"), i18n("Age"), QString(), Kopete::PropertyTmpl::PersistentProperty ), - propEmail(Kopete::Global::Properties::self()->emailAddress()) + propEmail(Kopete::Global::Properties::self()->emailAddress()) { kDebug( 14210 ) ; s_protocol = this; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ add_subdirectory(kopete) add_subdirectory(libkopete) -add_subdirectory(protocols) add_subdirectory(plugins) +add_subdirectory(protocols) diff --git a/tests/plugins/CMakeLists.txt b/tests/plugins/CMakeLists.txt --- a/tests/plugins/CMakeLists.txt +++ b/tests/plugins/CMakeLists.txt @@ -1,3 +1,3 @@ add_subdirectory(texteffect) add_subdirectory(autoreplace) - +add_subdirectory(contactnotes) diff --git a/tests/protocols/CMakeLists.txt b/tests/protocols/CMakeLists.txt --- a/tests/protocols/CMakeLists.txt +++ b/tests/protocols/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory(oscar) +add_subdirectory(qq) diff --git a/tests/protocols/qq/CMakeLists.txt b/tests/protocols/qq/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/tests/protocols/qq/CMakeLists.txt @@ -0,0 +1,22 @@ +find_package(Qt5 REQUIRED COMPONENTS Test) +include_directories( + ${CMAKE_SOURCE_DIR}/protocols/qq + ${CMAKE_SOURCE_DIR}/protocols/qq/icons + ${CMAKE_SOURCE_DIR}/protocols/qq/ui + ${KOPETE_SOURCE_DIR} +) + +set( + QQ_TEST_LIBRARIES + KF5::KDELibs4Support + Qt5::Test + ${CMAKE_SOURCE_DIR}/protocols/qq/crypt.cpp +) + +# Test for crypt(TEA) +set(qqcrypttest_SRCS qqcrypttest.cpp) +ecm_add_test( + ${qqcrypttest_SRCS} + LINK_LIBRARIES ${QQ_TEST_LIBRARIES} +) + diff --git a/tests/protocols/qq/qqcrypttest.cpp b/tests/protocols/qq/qqcrypttest.cpp new file mode 100644 --- /dev/null +++ b/tests/protocols/qq/qqcrypttest.cpp @@ -0,0 +1,60 @@ +#include "crypt.h" + +#include +#include + +class QQCryptTest : public QObject +{ + Q_OBJECT + +private slots: + void CryptTest(); +}; + +void QQCryptTest::CryptTest() +{ + char char_1[2]; + + char_1[0]='a'; + char_1[1]='b'; + + unsigned int a[2]; + unsigned int b[2]; + unsigned int c[2]; + unsigned int k[4]; + + a[0]=(int)char_1[0]; + a[1]=(int)char_1[1]; + + b[0]=0; + b[1]=0; + + c[0]=0; + c[1]=0; + + k[0]=1; + k[1]=2; + k[2]=3; + k[3]=4; + + unsigned int *const x=&a[0]; + unsigned int *const y=&b[0]; + unsigned int *const z=&c[0]; + const unsigned int *const key=&k[0]; + + /* void TEA::encipher(unsigned int *const v, const unsigned int *const k, unsigned int *const w); */ + TEA::encipher(x, key, y); + + /* void TEA::decipher(unsigned int *const v, const unsigned int *const k, unsigned int *const w); */ + TEA::decipher(y, key, z); + + char char_2[2]; + char_2[0]=(char)c[0]; + char_2[1]=(char)c[1]; + + QCOMPARE(char_1[0],char_2[0]); + QCOMPARE(char_1[1],char_2[1]); +} + +QTEST_MAIN(QQCryptTest) +#include "qqcrypttest.moc"