Skip to content

Commit

Permalink
Version 0.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dsafa committed Jul 15, 2019
2 parents 084a997 + 02e8f66 commit d985c78
Show file tree
Hide file tree
Showing 53 changed files with 1,259 additions and 178 deletions.
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Summary

## Checklist
- [ ] Tests passed
- [ ] Changes validated (manually or automated)
- [ ] Closes / Fixes #xxx (if applicable)

## Additional details / comments

## Manual test steps (if applicable)
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at brndnchong@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Intro
Thanks for taking the time to read this!
This doc contains guidelines and resources for contributing. It's not too complete but I'll add to it.

# Ways to contribute
## Reporting Bugs
Feel free to report bugs in the [issues tracker](https://github.com/dsafa/audio-band/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc).
There are templates when creating a new issue to help you get started. Try to search for existing bugs first, the keyword search is quite good.

## Suggest Features
You can also suggest features and improvements in the issue tracker as well.

## Development
Development docs are on the [github page](https://dsafa.github.io/audio-band/audioband/development/setup.html) for this repo.
The site will have instructions for setting up a build environment including instructions on how to debug a local setup as well as
an overview of the project itself.

I try to keep it as up to date as possible but like all docs, they tend to get outdated.
If something is out of date feel free to raise an issue about it.
11 changes: 10 additions & 1 deletion src/AudioBand.Test/AudioBand.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,18 @@
<Reference Include="Unosquare.Swan.Lite">
<HintPath>C:\Users\bdonc\.nuget\packages\unosquare.swan.lite\0.38.1\lib\net452\Unosquare.Swan.Lite.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="ValueConveters\PathToImageConverterTests.cs" />
<Compile Include="ValueConverters\BoolToVisibilityConverterTests.cs" />
<Compile Include="ValueConverters\ColorToBrushConverterTests.cs" />
<Compile Include="ValueConverters\FlagToBoolConverterTests.cs" />
<Compile Include="ValueConverters\MultiplyConverterTests.cs" />
<Compile Include="ValueConverters\ObjectToTypeConverterTests.cs" />
<Compile Include="ValueConverters\PathToImageConverterTests.cs" />
<Compile Include="ValueConverters\PointConverterTests.cs" />
<Compile Include="ValueConverters\StringToFontFamilyConverterTests.cs" />
<Compile Include="ValueConverters\TimeSpanToMsConverterTests.cs" />
<Compile Include="ViewModels\AlbumArtPopupViewModelTests.cs" />
<Compile Include="ViewModels\AlbumArtViewModelTests.cs" />
<Compile Include="ViewModels\AudioBandViewModelTests.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/AudioBand.Test/AudioBand.Test.csproj.DotSettings
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=settings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=textformatting/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=valueconverters/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=valueconveters/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=viewmodels/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
132 changes: 118 additions & 14 deletions src/AudioBand.Test/Settings/SettingsMigrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using V2Settings = AudioBand.Settings.Models.V2.Settings;
using Nett;
using Xunit;
using AudioSourceSetting = AudioBand.Settings.Models.V1.AudioSourceSetting;
using V1AudioSourceSetting = AudioBand.Settings.Models.V1.AudioSourceSetting;

namespace AudioBand.Test
{
Expand Down Expand Up @@ -137,13 +137,13 @@ public void MigrateV1ToV2_AudioSourceSettings()
var setting1 = new AudioSourceSettingsCollection
{
Name = "test",
Settings = new List<AudioSourceSetting> {new AudioSourceSetting {Name = "key1", Value = "val1"}}
Settings = new List<V1AudioSourceSetting> {new V1AudioSourceSetting {Name = "key1", Value = "val1"}}
};

var setting2 = new AudioSourceSettingsCollection
{
Name = "test2",
Settings = new List<AudioSourceSetting> { new AudioSourceSetting { Name = "key2", Value = "val2" } }
Settings = new List<V1AudioSourceSetting> { new V1AudioSourceSetting { Name = "key2", Value = "val2" } }
};

var settings = new List<AudioSourceSettingsCollection> {setting1,setting2};
Expand Down Expand Up @@ -415,17 +415,7 @@ public void MigrateV2ToV3_MigratesSuccessfully()
Name = ""Spotify Client secret""
Value = ""secret""
";
var settings = TomlSettings.Create(cfg =>
{
cfg.ConfigureType<System.Windows.Media.Color>(type => type.WithConversionFor<TomlString>(convert => convert
.ToToml(SerializationConversions.ColorToString)
.FromToml(tomlString => SerializationConversions.StringToColor(tomlString.Value))));
cfg.ConfigureType<CustomLabel.TextAlignment>(type => type.WithConversionFor<TomlString>(convert => convert
.ToToml(SerializationConversions.EnumToString)
.FromToml(str => SerializationConversions.StringToEnum<CustomLabel.TextAlignment>(str.Value))));
cfg.ConfigureType<double>(type => type.WithConversionFor<TomlInt>(c => c
.FromToml(tml => tml.Value)));
});
var settings = TomlHelper.DefaultSettings;

var v2 = Toml.ReadString<V2Settings>(settingsFile, settings);
var v3 = Migration.MigrateSettings<SettingsV3>(v2, "2", "3");
Expand Down Expand Up @@ -499,5 +489,119 @@ public void MigrateV2ToV3_MigratesSuccessfully()
Assert.Equal(v2.CustomLabelSettings[0].Alignment, v3.Profiles[SettingsV3.DefaultProfileName].CustomLabelSettings[0].Alignment);
Assert.Equal(v2.CustomLabelSettings[0].FormatString, v3.Profiles[SettingsV3.DefaultProfileName].CustomLabelSettings[0].FormatString);
}

[Fact]
public void ChainedMigrations_V1ToV3_SuccessfulMigration()
{
var v1Settings = @"
Version = ""0.1""
[AudioBandAppearance]
Width = 300
Height = 30
[PlayPauseButtonAppearance]
XPosition = 0
YPosition = 0
Width = 30
Height = 10
IsVisible = true
[NextSongButtonAppearance]
IsVisible = true
Width = 30
Height = 10
XPosition = 0
YPosition = 0
[PreviousSongButtonAppearance]
IsVisible = true
Width = 30
Height = 10
XPosition = 0
YPosition = 0
[[TextAppearances]]
IsVisible = true
Width = 100
Height = 15
XPosition = 150
YPosition = 10
FontSize = 10.0
Color = ""White""
Alignment = ""Center""
ScrollSpeed = 0
FormatString = ""{song}""
[ProgressBarAppearance]
ForegroundColor = ""Blue""
BackgroundColor = ""Gray""
IsVisible = true
XPosition = 0
YPosition = 26
Width = 200
Height = 2
[AlbumArtAppearance]
IsVisible = true
Width = 30
Height = 30
XPosition = 0
YPosition = 0
[AlbumArtPopupAppearance]
IsVisible = true
Width = 500
Height = 500
XOffset = 50
Margin = 6
";
var v1 = Toml.ReadString<V1Settings>(v1Settings, TomlHelper.DefaultSettings);
var v3 = Migration.MigrateSettings<SettingsV3>(v1, "0.1", "3");
var v3Profile = v3.Profiles[SettingsV3.DefaultProfileName];

Assert.Equal(v1.AudioBandAppearance.Width, v3Profile.AudioBandSettings.Width);
Assert.Equal(v1.AudioBandAppearance.Height, v3Profile.AudioBandSettings.Height);

Assert.Equal(v1.PlayPauseButtonAppearance.Width, v3Profile.PlayPauseButtonSettings.Width);
Assert.Equal(v1.PlayPauseButtonAppearance.Height, v3Profile.PlayPauseButtonSettings.Height);
Assert.Equal(v1.PlayPauseButtonAppearance.XPosition, v3Profile.PlayPauseButtonSettings.XPosition);
Assert.Equal(v1.PlayPauseButtonAppearance.YPosition, v3Profile.PlayPauseButtonSettings.YPosition);
Assert.Equal(v1.PlayPauseButtonAppearance.IsVisible, v3Profile.PlayPauseButtonSettings.IsVisible);

Assert.Equal(v1.NextSongButtonAppearance.Width, v3Profile.NextButtonSettings.Width);
Assert.Equal(v1.NextSongButtonAppearance.Height, v3Profile.NextButtonSettings.Height);
Assert.Equal(v1.NextSongButtonAppearance.XPosition, v3Profile.NextButtonSettings.XPosition);
Assert.Equal(v1.NextSongButtonAppearance.YPosition, v3Profile.NextButtonSettings.YPosition);
Assert.Equal(v1.NextSongButtonAppearance.IsVisible, v3Profile.NextButtonSettings.IsVisible);

Assert.Equal(v1.PreviousSongButtonAppearance.Width, v3Profile.PreviousButtonSettings.Width);
Assert.Equal(v1.PreviousSongButtonAppearance.Height, v3Profile.PreviousButtonSettings.Height);
Assert.Equal(v1.PreviousSongButtonAppearance.XPosition, v3Profile.PreviousButtonSettings.XPosition);
Assert.Equal(v1.PreviousSongButtonAppearance.YPosition, v3Profile.PreviousButtonSettings.YPosition);
Assert.Equal(v1.PreviousSongButtonAppearance.IsVisible, v3Profile.PreviousButtonSettings.IsVisible);

Assert.Single(v3Profile.CustomLabelSettings);
Assert.Equal(v1.TextAppearances[0].Color, v3Profile.CustomLabelSettings[0].Color);
Assert.Equal(v1.TextAppearances[0].Alignment, v3Profile.CustomLabelSettings[0].Alignment);
Assert.Equal(v1.TextAppearances[0].FontFamily, v3Profile.CustomLabelSettings[0].FontFamily);
Assert.Equal(v1.TextAppearances[0].FontSize, v3Profile.CustomLabelSettings[0].FontSize);
Assert.Equal(v1.TextAppearances[0].FormatString, v3Profile.CustomLabelSettings[0].FormatString);
Assert.Equal(v1.TextAppearances[0].Height, v3Profile.CustomLabelSettings[0].Height);
Assert.Equal(v1.TextAppearances[0].IsVisible, v3Profile.CustomLabelSettings[0].IsVisible);
Assert.Equal(v1.TextAppearances[0].Name, v3Profile.CustomLabelSettings[0].Name);
Assert.Equal(v1.TextAppearances[0].ScrollSpeed, v3Profile.CustomLabelSettings[0].ScrollSpeed);
Assert.Equal(v1.TextAppearances[0].Width, v3Profile.CustomLabelSettings[0].Width);
Assert.Equal(v1.TextAppearances[0].XPosition, v3Profile.CustomLabelSettings[0].XPosition);
Assert.Equal(v1.TextAppearances[0].YPosition, v3Profile.CustomLabelSettings[0].YPosition);

Assert.Equal(v1.AlbumArtAppearance.Height, v3Profile.AlbumArtSettings.Height);
Assert.Equal(v1.AlbumArtAppearance.IsVisible, v3Profile.AlbumArtSettings.IsVisible);
Assert.Equal(v1.AlbumArtAppearance.PlaceholderPath, v3Profile.AlbumArtSettings.PlaceholderPath);
Assert.Equal(v1.AlbumArtAppearance.Width, v3Profile.AlbumArtSettings.Width);
Assert.Equal(v1.AlbumArtAppearance.XPosition, v3Profile.AlbumArtSettings.XPosition);
Assert.Equal(v1.AlbumArtAppearance.YPosition, v3Profile.AlbumArtSettings.YPosition);
}
}
}
Loading

0 comments on commit d985c78

Please sign in to comment.