Skip to content

Commit 222eafe

Browse files
committed
Fixed compilation errors in tests during compilation player's build
1 parent ce470d1 commit 222eafe

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

Assets/_PackageRoot/Tests/Base/Extensions.Unity.ImageLoader.Tests.asmdef

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
"includePlatforms": [],
99
"excludePlatforms": [],
1010
"allowUnsafeCode": false,
11-
"overrideReferences": false,
11+
"overrideReferences": true,
1212
"precompiledReferences": [
13-
"NSubstitute.dll"
13+
"nunit.framework.dll"
14+
],
15+
"autoReferenced": false,
16+
"defineConstraints": [
17+
"UNITY_INCLUDE_TESTS"
1418
],
15-
"autoReferenced": true,
16-
"defineConstraints": [],
1719
"versionDefines": [],
1820
"noEngineReferences": false
1921
}

Assets/_PackageRoot/Tests/Base/Utils/TestUtils.LoadFail.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ public static IEnumerator LoadFail(string url, FutureLoadingFrom? expectedLoadin
2828

2929
var task1 = future.AsTask();
3030

31-
// TODO: To find a way to use it in a player build
32-
#if UNITY_EDITOR
31+
3332
if (expectedLoadingFrom.HasValue && expectedLoadingFrom.Value == FutureLoadingFrom.Source) // exception should be thrown only if ONLY loading from Source
3433
UnityEngine.TestTools.LogAssert.Expect(LogType.Error, $"[ImageLoader] Future[id={future.Id}] Timeout ({timeout}): {url}"); // compilation error in player build
35-
#endif
34+
3635
yield return TestUtils.WaitWhile(() => future.IsInProgress, TimeSpan.FromSeconds(10));
3736
var task2 = future.AsTask();
3837

Assets/_PackageRoot/Tests/Base/Utils/TestUtils.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,17 @@ public static IEnumerator ClearEverything(string message)
3131
{
3232
if (message != null)
3333
Debug.Log(message.PadRight(50, '-'));
34-
// TODO: To find a way to use it in a player build
35-
#if UNITY_EDITOR
34+
3635
UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true; // compilation error in player build
37-
#endif
36+
3837
UniTaskScheduler.UnobservedExceptionWriteLogType = LogType.Exception;
3938
ImageLoader.ClearSpriteRef();
4039
ImageLoader.ClearTextureRef();
4140
yield return ImageLoader.ClearCacheAll().TimeoutCoroutine(TimeSpan.FromSeconds(10));
4241

4342
WaitForGCFast();
4443

45-
// TODO: To find a way to use it in a player build
46-
#if UNITY_EDITOR
4744
UnityEngine.TestTools.LogAssert.ignoreFailingMessages = false; // compilation error in player build
48-
#endif
4945
}
5046
public static void WaitForGCFast()
5147
{

Assets/_PackageRoot/Tests/Editor/Extensions.Unity.ImageLoader.Tests.Editor.asmdef

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
],
1313
"excludePlatforms": [],
1414
"allowUnsafeCode": false,
15-
"overrideReferences": false,
15+
"overrideReferences": true,
1616
"precompiledReferences": [
17-
"NSubstitute.dll"
17+
"nunit.framework.dll"
18+
],
19+
"autoReferenced": false,
20+
"defineConstraints": [
21+
"UNITY_INCLUDE_TESTS"
1822
],
19-
"autoReferenced": true,
20-
"defineConstraints": [],
2123
"versionDefines": [],
2224
"noEngineReferences": false
2325
}

Assets/_PackageRoot/Tests/Runtime/Extensions.Unity.ImageLoader.Tests.Runtime.asmdef

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
"includePlatforms": [],
1010
"excludePlatforms": [],
1111
"allowUnsafeCode": false,
12-
"overrideReferences": false,
12+
"overrideReferences": true,
1313
"precompiledReferences": [
14-
"NSubstitute.dll"
14+
"nunit.framework.dll"
15+
],
16+
"autoReferenced": false,
17+
"defineConstraints": [
18+
"UNITY_INCLUDE_TESTS"
1519
],
16-
"autoReferenced": true,
17-
"defineConstraints": [],
1820
"versionDefines": [],
1921
"noEngineReferences": false
2022
}

0 commit comments

Comments
 (0)