File: channelFactory.cpp

package info (click to toggle)
giada 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,516 kB
  • sloc: cpp: 30,620; sh: 144; xml: 66; makefile: 55; ansic: 1
file content (39 lines) | stat: -rw-r--r-- 1,276 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

#include "../src/core/channels/channelFactory.h"
#include "../src/core/types.h"
#include <catch2/catch_test_macros.hpp>

using std::string;
using namespace giada;
using namespace giada::m;

TEST_CASE("channelFactory")
{
	SECTION("test creation")
	{
		channelFactory::Data data = channelFactory::create(
		    /*id=*/0,
		    ChannelType::SAMPLE,
		    /*bufferSize=*/1024,
		    Resampler::Quality::LINEAR,
		    /*overdubProtection=*/false);

		REQUIRE(data.channel.id != 0); // If ID == 0, must be auto-generated
		REQUIRE(data.channel.type == ChannelType::SAMPLE);

		SECTION("test clone")
		{
			channelFactory::Data clone = channelFactory::create(data.channel, /*bufferSize=*/1024, Resampler::Quality::LINEAR);

			REQUIRE(clone.channel.id != data.channel.id); // Clone must have new ID
			REQUIRE(clone.channel.type == data.channel.type);
			REQUIRE(clone.channel.volume == data.channel.volume);
			REQUIRE(clone.channel.pan == data.channel.pan);
			REQUIRE(clone.channel.armed == data.channel.armed);
			REQUIRE(clone.channel.key == data.channel.key);
			REQUIRE(clone.channel.hasActions == data.channel.hasActions);
			REQUIRE(clone.channel.getName(/*scene=*/0) == data.channel.getName(/*scene=*/0));
			REQUIRE(clone.channel.height == data.channel.height);
		}
	}
}