| 86 | } |
| 87 | |
| 88 | void ExtTestCaseTable::refreshTask(Task *nowTask) { |
| 89 | editTask = nowTask; |
| 90 | |
| 91 | if (editTask == nullptr) |
| 92 | return; |
| 93 | |
| 94 | setRowCount(0); |
| 95 | |
| 96 | auto testCases = editTask->getTestCaseList(); |
| 97 | |
| 98 | int nowrow = 0; |
| 99 | |
| 100 | for (int i = 0; i < testCases.size(); i++) { |
| 101 | auto *nowsub = editTask->getTestCase(i); |
| 102 | |
| 103 | int score = nowsub->getFullScore(); |
| 104 | auto inputs = nowsub->getInputFiles(); |
| 105 | auto outputs = nowsub->getOutputFiles(); |
| 106 | auto times = nowsub->getTimeLimit(); |
| 107 | auto mems = nowsub->getMemoryLimit(); |
| 108 | auto depends = nowsub->getDependenceSubtask(); |
| 109 | int fileCount = nowsub->getInputFiles().size(); |
| 110 | |
| 111 | for (int j = 0; j < fileCount; j++) { |
| 112 | insertRow(nowrow); |
| 113 | |
| 114 | addItem(nowrow, 1, inputs[j]); |
| 115 | addItem(nowrow, 2, outputs[j]); |
| 116 | |
| 117 | QString depStr = "", tipStr; |
| 118 | |
| 119 | if (editTask->getTaskType() == Task::AnswersOnly) |
| 120 | tipStr = QString(tr("Test Case #%1:\n%2 Pt")).arg(i + 1).arg(score); |
| 121 | else |
| 122 | tipStr = QString(tr("Test Case #%1:\n%2 Pt\nTime Limit: %3 ms\nMemory Limit: %4 MiB")) |
| 123 | .arg(i + 1) |
| 124 | .arg(score) |
| 125 | .arg(times) |
| 126 | .arg(mems); |
| 127 | |
| 128 | if (depends.empty()) |
| 129 | depStr = "(-)", tipStr = tipStr + tr("\nNo Depends"); |
| 130 | else { |
| 131 | depStr = QString("(%1)").arg(depends.size()); |
| 132 | tipStr = tipStr + QString(tr("\nDepends: ")); |
| 133 | |
| 134 | for (auto k : depends) |
| 135 | tipStr = tipStr + QString::number(k) + ", "; |
| 136 | } |
| 137 | |
| 138 | if (editTask->getTaskType() == Task::AnswersOnly) |
| 139 | addItem(nowrow, 0, QString(tr("#%1 :: %2 pt, %3")).arg(i + 1).arg(score).arg(depStr), tipStr); |
| 140 | else |
| 141 | addItem(nowrow, 0, |
| 142 | QString(tr("#%1 :: %2 pt, TL %3 ms, ML %4 MiB, %5")) |
| 143 | .arg(i + 1) |
| 144 | .arg(score) |
| 145 | .arg(times) |
no test coverage detected