test roommodel methods
Details
- Reviewers
mlaurent - Group Reviewers
Ruqola - Commits
- R865:1e58cc64f1e0: Add autotest for roommodel and user classes
Diff Detail
- Repository
- R865 Ruqola
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
autotests/roommodeltest.cpp | ||
---|---|---|
54 | check with selected 'true' (3rd arugument) |
- Change updateRoom method in roomModel and add tests for roomModel
previous updateRomm method in roomModel(QJsonObject) was changing with name, now roomId is considered for change.
add tests for updateSubcription
- clarity on updateRoom(QJsonObject)
can you please tell me exactly what updateRoom should do in roomModel.cpp?
It should update the existing values or It should update the existing values and add new values passed through arguments.
- diff b/w "updated" case and "changed" in roomModel.cpp??
autotests/roommodeltest.cpp | ||
---|---|---|
140 | Here it readOnly is true by default! Although we didn't mention it in QJsonObject. | |
165 | Since, this is a new roomId which is not added -> it should not be removed. |
autotests/usertest.cpp | ||
---|---|---|
45 | unable to define user class on stack -> User *u; Error |
autotests/usertest.cpp | ||
---|---|---|
137 | Here I think there is no need to check nameChanged and statusChagned signals since all those were checked earlier! |
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
69 ↗ | (On Diff #24748) | Same |
autotests/rocketchataccountsettingstest.h | ||
50 ↗ | (On Diff #24748) | why you add theses changes in this review §? |
autotests/roommodeltest.cpp | ||
65 | So ? do you still have error ? | |
102 | Same for name as you use it all the time create a variable for it | |
110 | it's better to compare "variable" to value > QCompare(spy.count(), 1) | |
130 | Fails ? which is the problem ? | |
131 | same QCompare(value, 1); fix all others QCOMPARE if necessary it's value compare with expected when it failed you can see correct debug | |
165 | you still use input.append(QJsonValue(QLatin1String("removed"))); so it's correct no. otherwise you need to need to have QStringLiteral("inserted") | |
213 | readOnly true... | |
256 | yep todo | |
autotests/usertest.cpp | ||
45 | ? what is the error? | |
137 | We need to do it because for the moment yep we use this code: setName(fields.value(QLatin1String("name")).toString()); setUserId(object.value(QLatin1String("id")).toString()); setStatus(fields.value(QLatin1String("status")).toString());" so we know that we use setName/setStatus etc. > signal will not emit and it will be an error> test signal too. | |
159 | != please :) | |
src/roommodel.cpp | ||
233 | qCDebug(...) |
clarity on updateRoom(QJsonObject)
- can you please tell me exactly what updateRoom should do in roomModel.cpp?
- It should update the existing values or It should update the existing values and add new values passed through arguments.
diff b/w "updated" case and "changed" in roomModel.cpp??
autotests/roommodeltest.cpp | ||
---|---|---|
213 | Sry, I actually raised this issue in L138 only !! in the previous update, same problem here also | |
autotests/usertest.cpp | ||
45 | Sry, NO ERROR | |
159 | we don't have != for User class, thats why I used ! ( == ) |
autotests/rocketchataccountsettingstest.h | ||
---|---|---|
50 ↗ | (On Diff #24748) | I'll remove this in next update |
autotests/usertest.cpp | ||
---|---|---|
159 | Add the missing operator in class. |
- Fix parseUpdateRoom method in room.cpp
oom(QJsonObject) used the above method for updating name, satus, announcements but that method in room.cpp doesn't update name of the room from QJsonObject.
Now it if fixed, name also will be updated.
autotests/roommodeltest.cpp | ||
---|---|---|
65 | changed the code for findRoom in roomModel.cpp NO ERROR it returns new roomWrapper with no room initialized in it but, when u try to access the name of the room then we'll get null pointer access error! that is in commented line. | |
130 | It is fixed now:) problem was in praseUpdate method in room.cpp class, it was not updating name. pl. have a look at changes in room.cpp file forgot to remove comment "here it fails!", it will be removed in next update. | |
188 | shouldUpdateSubcriptionActionChanged is not tested, since changed case in updateSubscription method in roomModel doesn't do anything new other than updating pl. have a look at updateSubcription method in roomModel.cpp |
autotests/roommodeltest.cpp | ||
---|---|---|
70 | So you need to test that pointer is null here. But I prefere that we check this value | |
257 | Good for testing default value but please add a test when it's not default value too thanks. | |
autotests/usertest.cpp | ||
50 | QCOMPARE(current value, expected) same for other QCOMPARE | |
src/roommodel.cpp | ||
77 | If we don't find roomId we mustn't create a new RoomWrapper. | |
233 | qCDebug(debug categori") and uncomment it please. | |
src/user.cpp | ||
82 | heu... return !User::operator(User) it doesn't work ? |
- write non-default test cases for data method in roomModel
rewrite QCOMPARE() properly in userTest.cpp
log the print statments in roomModel to RUQOLA_LIB through qCDebug
change the findRoom method to return nullptr if it doesn't find room!
autotests/usertest.cpp | ||
---|---|---|
50 | Done it in roomModelTest but forgot in userTest now, it is corrected everywhere!:) |
autotests/roommodeltest.cpp | ||
---|---|---|
345 | compare with selected value no ? | |
365 | QCOMPARE(..., favorite) | |
autotests/usertest.cpp | ||
50 | QCOMPARE(value, expected) | |
74 | QCOMPARE(value, expected) please verify each QCOMPARe | |
src/roommodel.cpp | ||
233 | RUQOLA_LOG without () I know that it compiles but we use by default without () same for others code |
src/roommodel.cpp | ||
---|---|---|
233 | RUQOLA_LOG without () ... |
src/roommodel.cpp | ||
---|---|---|
233 | nope "RUQOLA_LOG without () I know that it compiles but we use by default without () same for others code" > qDebug(RUQOLA_LOG) << ... |
tests/CMakeLists.txt | ||
---|---|---|
63 ↗ | (On Diff #25195) | Remove all this code.... Please create several branch where you put specific code as autotests and and other one for qmlFileTestResources git checkout -b add_autotest_room_model for this one and git checkout -b add_qmltest for other one. Please rebase from master I changed a lot of thing. |