PrimaryFeather / Sparrow-Framework

The Open Source Game Engine for iOS
http://www.sparrow-framework.org
Other
538 stars 173 forks source link

Unable to load resources in octest bundles #1010

Closed Odie closed 13 years ago

Odie commented 13 years ago

[Moved from forums]

Problem: The library currently isn't able to find any media resources in a unit test bundle.
How to reproduce: Create any unit test bundle that exercises loading a resource using the SenTestingKit.

Cause:Various spots in the library that loads resources uses a [NSBundle mainBundle] as the basis for retrieving a resource. When running a SentTestingKit unit test bundle, the tests are injected into another executable, "octest" which will actually run the tests. The mainBundle path will always be where "octest" is located, not where the intended game executable and resources are.

PrimaryFeather commented 13 years ago

Closed with #1007.

I added a new extension method: [NSBundle appBundle], and use it throughout the framework. This method uses [NSBundle bundleForClass:] internally, which works in unit tests, too.

Thanks again for pointing me to this!