Commit 43a6e6b4 authored by Daniel Smith's avatar Daniel Smith Committed by Andy Nichols

Enable running of autotests in master

parent 57018c54
......@@ -16,15 +16,26 @@ build_with_linux:
- linux
script:
- echo "Starting Build"
- ~/Qt/5.12.3/gcc_64/bin/qmake
- mkdir build && cd build
- ~/Qt/5.12.3/gcc_64/bin/qmake ../qtdemonrender.pro
- make
- make sub-tests
- cd tests && make check
# artifacts:
# name: "$CI_JOB_NAME"
# paths:
# - build/
# expire_in: 1 week
test_with_linux:
stage: test
tags:
- linux
script:
- echo "No tests to run at this time... Please add some."
# test_with_linux:
# stage: test
# tags:
# - linux
# script:
# - cd tests
# - make check
# dependencies:
# - build_with_linux
build_with_windows:
stage: build
......@@ -33,12 +44,25 @@ build_with_windows:
script:
- echo "Starting Build"
- "call \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\""
- "\"C:\\Qt\\5.12.3\\msvc2017_64\\bin\\qmake.exe\""
- mkdir build
- cd build
- "\"C:\\Qt\\5.12.3\\msvc2017_64\\bin\\qmake.exe\" ..\\qtdemonrender.pro"
- "\"C:\\JOM\\JOM.exe\" /J 9"
- "\"C:\\JOM\\JOM.exe\" sub-tests /J 9"
- cd tests
- "\"C:\\JOM\\JOM.exe\" check"
# artifacts:
# name: "%CI_JOB_NAME"
# paths:
# - build\
# expire_in: 1 week
test_with_windows:
stage: test
tags:
- windows
script:
- echo "No tests to run at this time... Please add some."
\ No newline at end of file
# test_with_windows:
# stage: test
# tags:
# - windows
# script:
# - cd "tests"
# - "\"C:\\JOM\\JOM.exe\" check"
# dependencies:
# - build_with_windows
\ No newline at end of file
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
QT += testlib
QT += gui demonassetimport core
CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += tst_assetimport.cpp
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
# Blender MTL File: 'cube_scene.blend'
# Material Count: 4
newmtl CylinderMaterial
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.008269 0.640000 0.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl CylinderTopMaterial
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.585538 0.124317 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl FrontFaceMaterial
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.010971 0.005700 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd textures\uvchecker.png
newmtl MainCubeMaterial
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.039211 0.018450
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd textures\uvchecker.png
This diff is collapsed.
#include <QtTest>
#include <QDebug>
#include <QtDemonAssetImport/QDemonAssetImportManager>
#include <QDir>
#include <QByteArray>
// add necessary includes here
class tst_assetimport : public QObject
{
Q_OBJECT
public:
tst_assetimport();
~tst_assetimport();
private slots:
void initTestCase();
void cleanupTestCase();
void importFile_data();
void importFile();
};
tst_assetimport::tst_assetimport()
{
}
tst_assetimport::~tst_assetimport()
{
}
void tst_assetimport::initTestCase()
{
}
void tst_assetimport::cleanupTestCase()
{
}
void tst_assetimport::importFile_data()
{
QTest::addColumn<QString>("extension");
QTest::addColumn<bool>("result");
QTest::addColumn<QByteArray>("expectedHash");
#ifdef __linux__
QTest::newRow("fbx") << QString("fbx") << true << QByteArray("c9353c3c2f9681d9053d5145d2fe859e");
QTest::newRow("dae") << QString("dae") << true << QByteArray("affb0aa717928fedebb8ab3edbbd4e00");
QTest::newRow("obj") << QString("obj") << true << QByteArray("890b94fe5315c9595d97561f8d879464");
QTest::newRow("blend") << QString("blend") << true << QByteArray("fb6049cbd40c2dee06c0165b0faaf6f5");
QTest::newRow("gltf") << QString("gltf") << true << QByteArray("2a804e289ce699db8d0c3cc6a72bfc6f");
QTest::newRow("glb") << QString("glb") << true << QByteArray("2a804e289ce699db8d0c3cc6a72bfc6f");
#elif _WIN32
QTest::newRow("fbx") << QString("fbx") << true << QByteArray("44960575115bdedd344d0cbbf037cf2c");
QTest::newRow("dae") << QString("dae") << true << QByteArray("affb0aa717928fedebb8ab3edbbd4e00");
QTest::newRow("obj") << QString("obj") << true << QByteArray("ee7d36950d4677ac2a01e97c406d1b51");
QTest::newRow("blend") << QString("blend") << true << QByteArray("6b519f1f36da183a06655ac460cd66e6");
QTest::newRow("gltf") << QString("gltf") << true << QByteArray("2a804e289ce699db8d0c3cc6a72bfc6f");
QTest::newRow("glb") << QString("glb") << true << QByteArray("2a804e289ce699db8d0c3cc6a72bfc6f");
#else
QSKIP("Test not configured for this platform.")
#endif
}
void tst_assetimport::importFile()
{
QFETCH(QString, extension);
QFETCH(bool, result);
QFETCH(QByteArray, expectedHash);
QDemonAssetImportManager importManager;
QString file = "resources/cube_scene." + extension;
QString error;
QByteArray fileChecksum;
// Should return "true" if there were no errors opening the source or creating the exported object.
auto realResult = importManager.importFile(QFINDTESTDATA(file), QDir("./"), &error);
if(!error.isEmpty()){
qDebug() << "Error message:" << error;
QFAIL(error.toStdString().c_str());
} else {
// Generate a file hash of the created QML export to verify it was created correctly.
// Returns empty QByteArray() on failure.
QFile f("Cube_scene.qml");
if (f.open(QFile::ReadOnly)) {
QCryptographicHash hash(QCryptographicHash::Md5);
if (hash.addData(&f)) {
fileChecksum = hash.result();
}
}
}
QCOMPARE(realResult, result);
QCOMPARE(fileChecksum.toHex(), expectedHash);
}
QTEST_APPLESS_MAIN(tst_assetimport)
#include "tst_assetimport.moc"
TEMPLATE = subdirs
SUBDIRS = cmake
TEMPLATE = subdirs
SUBDIRS = cmake \
assetimport
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment