| 121 | } |
| 122 | |
| 123 | bool TestUtils::deployFile(const QString &file, const QString &distanation, |
| 124 | const QHash<QByteArray, QByteArray> &replaceCase) const { |
| 125 | QFile f(file); |
| 126 | |
| 127 | if (f.open(QIODevice::ReadOnly)) { |
| 128 | QFile dist(distanation); |
| 129 | if (!dist.open(QIODevice::WriteOnly | QIODevice::Truncate)) { |
| 130 | return false; |
| 131 | } |
| 132 | |
| 133 | QByteArray data = f.readAll(); |
| 134 | for (auto it = replaceCase.begin(); it != replaceCase.end(); ++it) { |
| 135 | data.replace(it.key(), it.value()); |
| 136 | } |
| 137 | |
| 138 | return dist.write(data); |
| 139 | } |
| 140 | |
| 141 | return false; |
| 142 | } |
| 143 | |