Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

Commit

Permalink
Add missing files to VCS
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinDuquesnoy committed Jul 13, 2017
1 parent 6870e73 commit 97d1314
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/MellowPlayer/Application/Style/DefaultStyle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"accent": "#ffc107",
"background": "#ffffff",
"foreground": "#505050",
"primary": "#5f81d4",
"primaryForeground": "#ffffff",
"secondary": "",
"secondaryForeground": "#ffffff"
}
13 changes: 13 additions & 0 deletions lib/MellowPlayer/Application/Style/IStyleLoader.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include "Style.hpp"

namespace MellowPlayer::Application {

class IStyleLoader {
public:
virtual ~IStyleLoader() = default;

virtual Style load(const QString& path) const = 0;
};
}
43 changes: 43 additions & 0 deletions tests/Mocks/StyleLoaderMock.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#pragma once
#include <fakeit.hpp>
#include <memory>
#include <MellowPlayer/Application/Style/IStyleLoader.hpp>
#include <MellowPlayer/Application/Style/Style.hpp>

using namespace MellowPlayer::Application;
using namespace fakeit;

class StyleLoaderMock {
public:
static Mock<IStyleLoader> get() {
Mock<IStyleLoader> mock;
When(Method(mock, load)).AlwaysDo([](const QString&){
auto randomColors = [](int count) {
QVector<QColor> colors;
float currentHue = 0.0;
for (int i = 0; i < count; i++){
colors.push_back( QColor::fromHslF(currentHue, 1.0, 0.5) );
currentHue += 0.618033988749895f;
currentHue = std::fmod(currentHue, 1.0f);
}
return colors;
};

auto colors = randomColors(7);

Style style;
style.accent = colors[0].name();
style.background = colors[1].name();
style.foreground = colors[2].name();
style.primary = colors[3].name();
style.primaryForeground = colors[4].name();
style.secondary = colors[5].name();
style.secondaryForeground = colors[6].name();

return style;

});
return mock;
}
};

0 comments on commit 97d1314

Please sign in to comment.