Fix unit test compile failures and crashes

This commit is contained in:
Brad Davis 2018-05-08 09:11:13 -07:00
parent d5afb3a49b
commit 6e16109fa4
4 changed files with 21 additions and 6 deletions

View file

@ -39,6 +39,7 @@ void AnimTests::initTestCase() {
void AnimTests::cleanupTestCase() {
//DependencyManager::destroy<AnimationCache>();
DependencyManager::get<ResourceManager>()->cleanup();
}
void AnimTests::testClipInternalState() {

View file

@ -76,7 +76,9 @@ void KtxTests::testKtxEvalFunctions() {
void KtxTests::testKtxSerialization() {
const QString TEST_IMAGE = getRootPath() + "/scripts/developer/tests/cube_texture.png";
QImage image(TEST_IMAGE);
gpu::TexturePointer testTexture = image::TextureUsage::process2DTextureColorFromImage(image, TEST_IMAGE.toStdString(), true);
std::atomic<bool> abortSignal;
gpu::TexturePointer testTexture =
image::TextureUsage::process2DTextureColorFromImage(std::move(image), TEST_IMAGE.toStdString(), true, abortSignal);
auto ktxMemory = gpu::Texture::serialize(*testTexture);
QVERIFY(ktxMemory.get());

View file

@ -11,16 +11,23 @@
#include <QNetworkDiskCache>
#include "ResourceCache.h"
#include "NetworkAccessManager.h"
#include "DependencyManager.h"
#include <ResourceCache.h>
#include <LimitedNodeList.h>
#include <NodeList.h>
#include <NetworkAccessManager.h>
#include <DependencyManager.h>
#include <StatTracker.h>
QTEST_MAIN(ResourceTests)
void ResourceTests::initTestCase() {
auto resourceCacheSharedItems = DependencyManager::set<ResourceCacheSharedItems>();
//DependencyManager::set<AddressManager>();
DependencyManager::set<StatTracker>();
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
DependencyManager::set<NodeList>(NodeType::Agent, INVALID_PORT);
DependencyManager::set<ResourceCacheSharedItems>();
DependencyManager::set<ResourceManager>();
const qint64 MAXIMUM_CACHE_SIZE = 1024 * 1024 * 1024; // 1GB
// set up the file cache
@ -34,6 +41,10 @@ void ResourceTests::initTestCase() {
networkAccessManager.setCache(cache);
}
void ResourceTests::cleanupTestCase() {
DependencyManager::get<ResourceManager>()->cleanup();
}
static QSharedPointer<Resource> resource;

View file

@ -18,6 +18,7 @@ private slots:
void initTestCase();
void downloadFirst();
void downloadAgain();
void cleanupTestCase();
};
#endif // hifi_ResourceTests_h