Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Only register SoundSourceProviders when actually necessary #3974

Merged
merged 1 commit into from
Jun 10, 2021

Conversation

Holzhaus
Copy link
Member

This allows tests to inherit from MixxxTest and still register
SoundSourceProviders themselves, e.g. by instantiating CoreServices.
It also reduces log spam caused by the sound source provider
registration.

#pragma once
#include "sources/soundsourceproxy.h"

class SoundSourceMixin {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about naming it SoundSourceProviderRegistration? With a doc comment stating that this class is supposed to be used as a mixin for test classes that require accessing SoundSources.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SoundSourceProviderRegistrationMixin?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However. It does not need to be used strictly as a mixin. You could also instantiate the class a simple member.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just the RAII pattern. You only need to use it as mixin if the constructor must run before another base class. But this depends on the usage context and is not an inherent restriction of the class as such.

This allows tests to inherit from MixxxTest and still register
SoundSourceProviders themselves, e.g. by instantiating CoreServices.
It also reduces log spam caused by the sound source provider
registration.
@uklotzde
Copy link
Contributor

Thanks. Speedup is negligible, but the reduced log spam is worth it.

@uklotzde uklotzde merged commit 5175686 into mixxxdj:main Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants