diff options
| -rw-r--r-- | NT/src/nodes_source.h | 11 | ||||
| -rw-r--r-- | NT/src/rotor.h | 2 | ||||
| -rw-r--r-- | gtest/testgtest.cpp | 22 | ||||
| -rw-r--r-- | rotord/src/nodes_channels.h | 1 | ||||
| -rw-r--r-- | rotord/src/rotor.h | 8 |
5 files changed, 42 insertions, 2 deletions
diff --git a/NT/src/nodes_source.h b/NT/src/nodes_source.h index 08da163..ede0dcb 100644 --- a/NT/src/nodes_source.h +++ b/NT/src/nodes_source.h @@ -6,9 +6,15 @@ namespace Rotor { class Signal_colour: public Image_node { public: + //has a palette of colours which can be initialised from json or from an inlet + //1 - a data type which is a variable length array of data [as opposed to a array of inlets] + //2 - a way to initialise this from json + //enum - this is a hack to achieve this? designed for option selectors, can it work here? + //or just parse a string into a list of colours? Signal_colour(){ selector=create_inlet<double>("selector"); - create_attribute("palette","palette list of web colours","Colour palette","000000"); + palette=create_inlet<string>("palette","colour to choose from palette","Palette","000000") + //create_attribute("palette","palette list of web colours","Colour palette","000000"); title="Signal colour"; description="Cycles through a palette of background colours according to selector signal"; NODEID="a2183fe0-2d09-11e3-9a64-538ee2cf40bc"; @@ -42,7 +48,9 @@ namespace Rotor { vector<Colour> palette; int prevcol; Number_inlet *selector; + Enum_inlet *palette; }; + /* class Signal_greyscale: public Image_node { //Draws signal bars in greyscale public: @@ -73,5 +81,6 @@ namespace Rotor { private: uint8_t prevcol; }; + */ } #endif diff --git a/NT/src/rotor.h b/NT/src/rotor.h index 2ddf3ee..59533f5 100644 --- a/NT/src/rotor.h +++ b/NT/src/rotor.h @@ -91,7 +91,7 @@ namespace Rotor { template <class NT> class Node_type; class Enum{ - //enumerated string type for menus + //enumerated string type for node options that can appear in a menu public: Enum(std::initializer_list<std::string> init={},int def=0) : labels(init), value(def){}; int get_value(){return value;}; diff --git a/gtest/testgtest.cpp b/gtest/testgtest.cpp new file mode 100644 index 0000000..bca9594 --- /dev/null +++ b/gtest/testgtest.cpp @@ -0,0 +1,22 @@ +#include "gtest/gtest.h" +#include "math.h" + +double squareroot(double input){ + return pow(input,0.5); +} + +TEST(SquareRootTest, PositiveNos) { + EXPECT_EQ (18.0, squareroot(324.0)); + EXPECT_EQ (25.4, squareroot(645.16)); + EXPECT_EQ (50.3321, squareroot(2533.310224)); +} + +TEST (SquareRootTest, ZeroAndNegativeNos) { + ASSERT_EQ (0.0, squareroot (0.0)); + ASSERT_EQ (-1, squareroot(-22.0)); +} + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}
\ No newline at end of file diff --git a/rotord/src/nodes_channels.h b/rotord/src/nodes_channels.h index 3b3fa70..7e5b507 100644 --- a/rotord/src/nodes_channels.h +++ b/rotord/src/nodes_channels.h @@ -373,6 +373,7 @@ namespace Rotor { apply_LUT(in,image); } void apply_LUT(const Image& in,Image &out){ //facility to apply to other images for inherited classes + if (in.w==0) cerr<<type<<" node "<<ID<<" requesting 0 size LUT "<<endl; out.setup(in.w,in.h); for (int i=0;i<out.w*out.h*3;i++){ out.RGBdata[i]=LUT[in.RGBdata[i]]; diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index f54f80d..608f02a 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -127,6 +127,14 @@ inputs: [ so there needs to be a hook for this + if (images[absframe]->w==0) cerr<<type<<" node "<<ID<<" requesting 0 size image "<<endl; + + where is 0x0 image setup coming from? + its from operator= in cvImage + + what is setting image=otherimage where otherimage isn't initialised? + its NOT echo trails afaik + -------------------------*/ |
