| 1 |
|
| 2 |
#include <iostream> |
| 3 |
|
| 4 |
#include <QCoreApplication> |
| 5 |
#include <QFile> |
| 6 |
|
| 7 |
#include "rcc_obj.h" |
| 8 |
|
| 9 |
int main(int argc, char* argv[]) |
| 10 |
{ |
| 11 |
QCoreApplication app(argc, argv); |
| 12 |
|
| 13 |
// Test that the resource from the OBJECT library is accessible |
| 14 |
QString resourcePath = RccObj::resourceContent(); |
| 15 |
if (!QFile::exists(resourcePath)) { |
| 16 |
std::cerr << "Resource not found: " << resourcePath.toStdString() |
| 17 |
<< std::endl; |
| 18 |
return 1; |
| 19 |
} |
| 20 |
|
| 21 |
QFile file(resourcePath); |
| 22 |
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { |
| 23 |
std::cerr << "Failed to open resource: " << resourcePath.toStdString() |
| 24 |
<< std::endl; |
| 25 |
return 1; |
| 26 |
} |
| 27 |
|
| 28 |
QString content = file.readAll(); |
| 29 |
if (content.isEmpty()) { |
| 30 |
std::cerr << "Resource content is empty" << std::endl; |
| 31 |
return 1; |
| 32 |
} |
| 33 |
|
| 34 |
std::cout << "Resource content: " << content.toStdString() << std::endl; |
| 35 |
std::cout << "Test passed!" << std::endl; |
| 36 |
|
| 37 |
return 0; |
| 38 |
} |