Repository navigation
Conversation
a108d95 to
e13f1a4
Compare
| * \param readableName Human-readable application name, e.g. "FooBar player 1.2.3" | ||
| * \param userAgent HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0" | ||
| */ | ||
| - (void)setHumanReadableName:(NSString *)readableName withHTTPUserAgent:(NSString *)userAgent; |
There was a problem hiding this comment.
Not entirely sure how this can be tested...
| * \param version Application version numbers, e.g. "1.2.3" | ||
| * \param icon Application icon name, e.g. "foobar" | ||
| */ | ||
| - (void)setApplicationIdentifier:(NSString *)identifier withVersion:(NSString *)version andApplicationIconName:(NSString *)icon; |
604bd1d to
154b692
Compare
| for option in tests { | ||
| let library = try XCTAssertNotNilAndUnwrap(VLCLibrary(options: option)) | ||
| XCTAssertNotNil(library.instance) | ||
| assertDefaultParameters() |
There was a problem hiding this comment.
Wouldn't it be easier to understand and recognize why a test fails if you don't have a for loop and dict but write the params to test inline?
I know it's less code but right now I have to take some time to understand what line corresponds to a failing test if it would fail here. I'm also a bit unsure why we need to assertDefaultParams for : ["--no-video-title-show", "--verbose=4"]. If both of these are defaults it probably makes sense to test it as well with options that are not the default
There was a problem hiding this comment.
There is no way to actually see if the custom options were successfully saved because the options are saved via
_instance = libvlc_new(count, lib_vlc_params);where _instance is a void *.
So I just ended up making two dummy options and checking if the library was initialized successfully.
There was a problem hiding this comment.
Maybe I could init a mock libvlc_new(count, lib_vlc_params) and compare the two instances?? Is there a libvlc_compare_library method?
There was a problem hiding this comment.
I don't think there is but you can cast or bridge the void pointer into the correct object :)
| (3, 3), | ||
| (4, 4), | ||
| (100, 0), | ||
| (-10, 0) |
|
|
||
| XCTAssert(library.version.count > 1) | ||
| XCTAssert(library.compiler.count > 1) | ||
| XCTAssert(library.changeset.count > 1) |
There was a problem hiding this comment.
What you're testing for here is a bit unclear for me. Those are strings but the way the test is written it looks like you're testing an array. What do you think about testing for a not empty string and providing a message like "compiler should hold the string of the libvlccompiler, e.g. "gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)"? That way if the test fails we know roughly what we expected
There was a problem hiding this comment.
I thought about doing
XCTAssertEqual(library.compiler, "gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6))"but every time the library gets an update, you would have to update the tests as well or else, they would fail. Is this desirable?
There was a problem hiding this comment.
I was thinking more along the lines of XCTAssertFalse (library.compiler. isEmpty, "compiler is empty but it should hold a string of the form e.g. "gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)")
| let defaultParams = UserDefaults.standard.object(forKey: paramKey) | ||
|
|
||
| #if os(macOS) | ||
| XCTAssertEqual(defaultParams as? [String], expected) |
There was a problem hiding this comment.
When is defaultParams ever nil? Does it make sense to make this also not optional?
There was a problem hiding this comment.
defaultParams is set in VLCLibrary during an init. But the user could override it by using the same key by mistake since the parameters are stored in UserDefaults.standard
There was a problem hiding this comment.
I'm still confused a bit by this test :D so I overread the nil two lines down for iOS and I thought this test makes sure that the defaultParams are always not nil and set?
There was a problem hiding this comment.
defaultParams is nill for iOS and tvOS because VLCLibrary.m DOES NOT set the default parameters in the UserDefaults #if TARGET_OS_IPHONE. It does save the default params in UserDefaults otherwise.
Line 101 in ba9d2cd
| XCTAssertTrue(library.debugLogging) | ||
|
|
||
| library.debugLogging = false | ||
| XCTAssertFalse(library.debugLogging) |
|
|
||
| XCTAssertFalse(library.version.isEmpty, warn("3.0.4 Vetinari")) | ||
| XCTAssertFalse(library.compiler.isEmpty, warn("InstalledDir: /Applications/Xcode.app/...")) | ||
| XCTAssertFalse(library.changeset.isEmpty, warn("3.0.3-1-108-g7039639e6b")) |
Needs to be rebased once #30 is merged