Changeset View
Changeset View
Standalone View
Standalone View
tests/features/cuke-steps.cpp
Show First 20 Lines • Show All 396 Lines • ▼ Show 20 Line(s) | 395 | GIVEN("^the central list contains items named:") { | |||
---|---|---|---|---|---|
397 | 397 | | |||
398 | ScenarioScope<ZanshinContext> context; | 398 | ScenarioScope<ZanshinContext> context; | ||
399 | context->dragIndices.clear(); | 399 | context->dragIndices.clear(); | ||
400 | 400 | | |||
401 | auto model = context->presentation->property("centralListModel").value<QAbstractItemModel*>(); | 401 | auto model = context->presentation->property("centralListModel").value<QAbstractItemModel*>(); | ||
402 | context->waitForEmptyJobQueue(); | 402 | context->waitForEmptyJobQueue(); | ||
403 | context->setModel(model); | 403 | context->setModel(model); | ||
404 | 404 | | |||
405 | for (const auto row : tableParam.hashes()) { | 405 | for (const auto &row : tableParam.hashes()) { | ||
406 | for (const auto it : row) { | 406 | for (const auto &it : row) { | ||
407 | const QString itemName = QString::fromUtf8(it.second.data()); | 407 | const QString itemName = QString::fromUtf8(it.second.data()); | ||
408 | QModelIndex index = Zanshin::findIndex(context->model(), itemName); | 408 | QModelIndex index = Zanshin::findIndex(context->model(), itemName); | ||
409 | VERIFY_OR_DUMP(index.isValid()); | 409 | VERIFY_OR_DUMP(index.isValid()); | ||
410 | context->dragIndices << index; | 410 | context->dragIndices << index; | ||
411 | } | 411 | } | ||
412 | } | 412 | } | ||
413 | } | 413 | } | ||
414 | 414 | | |||
▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Line(s) | |||||
742 | THEN("^the list is") { | 742 | THEN("^the list is") { | ||
743 | TABLE_PARAM(tableParam); | 743 | TABLE_PARAM(tableParam); | ||
744 | 744 | | |||
745 | ScenarioScope<ZanshinContext> context; | 745 | ScenarioScope<ZanshinContext> context; | ||
746 | auto roleNames = context->model()->roleNames(); | 746 | auto roleNames = context->model()->roleNames(); | ||
747 | QSet<int> usedRoles; | 747 | QSet<int> usedRoles; | ||
748 | 748 | | |||
749 | QStandardItemModel inputModel; | 749 | QStandardItemModel inputModel; | ||
750 | for (const auto row : tableParam.hashes()) { | 750 | for (const auto &row : tableParam.hashes()) { | ||
751 | QStandardItem *item = new QStandardItem; | 751 | QStandardItem *item = new QStandardItem; | ||
752 | for (const auto it : row) { | 752 | for (const auto &it : row) { | ||
753 | const QByteArray roleName = it.first.data(); | 753 | const QByteArray roleName = it.first.data(); | ||
754 | const QString value = QString::fromUtf8(it.second.data()); | 754 | const QString value = QString::fromUtf8(it.second.data()); | ||
755 | const int role = roleNames.key(roleName, -1); | 755 | const int role = roleNames.key(roleName, -1); | ||
756 | VERIFY_OR_DUMP(role != -1); | 756 | VERIFY_OR_DUMP(role != -1); | ||
757 | item->setData(value, role); | 757 | item->setData(value, role); | ||
758 | usedRoles.insert(role); | 758 | usedRoles.insert(role); | ||
759 | } | 759 | } | ||
760 | inputModel.appendRow(item); | 760 | inputModel.appendRow(item); | ||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |