]> git.sesse.net Git - movit/blobdiff - effect_chain_test.cpp
Increase version number after YADIF.
[movit] / effect_chain_test.cpp
index 28ccc70b0bde6c136705d7bbba685a93e390763d..32beb41b45df0c4e67c7490f884f3581eb2b2963 100644 (file)
@@ -98,6 +98,25 @@ TEST(MirrorTest, BasicTest) {
        expect_equal(expected_data, out_data, 3, 2);
 }
 
+TEST(EffectChainTest, TopLeftOrigin) {
+       float data[] = {
+               0.0f, 0.25f, 0.3f,
+               0.75f, 1.0f, 1.0f,
+       };
+       // Note that EffectChainTester assumes bottom-left origin, so by setting
+       // top-left, we will get flipped data back.
+       float expected_data[6] = {
+               0.75f, 1.0f, 1.0f,
+               0.0f, 0.25f, 0.3f,
+       };
+       float out_data[6];
+       EffectChainTester tester(data, 3, 2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       tester.get_chain()->set_output_origin(OUTPUT_ORIGIN_TOP_LEFT);
+       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR);
+
+       expect_equal(expected_data, out_data, 3, 2);
+}
+
 // A dummy effect that inverts its input.
 class InvertEffect : public Effect {
 public:
@@ -932,7 +951,7 @@ TEST(EffectChainTest, SameInputsGiveSameOutputs) {
                0.0f, 0.0f,
                0.0f, 0.0f,
        };
-       float out_data[2 * 2];
+       float out_data[4 * 3];
        
        EffectChainTester tester(NULL, 4, 3);  // Note non-square aspect.
 
@@ -1229,7 +1248,12 @@ TEST(EffectChainTest, StringStreamLocalesWork) {
        // the test will always succeed. Note that the OpenGL driver might call
        // setlocale() behind-the-scenes, and that might corrupt the returned
        // pointer, so we need to take our own copy of it here.
-       char *saved_locale = strdup(setlocale(LC_ALL, "nb_NO.UTF_8"));
+       char *saved_locale = setlocale(LC_ALL, "nb_NO.UTF_8");
+       if (saved_locale == NULL) {
+               // The locale wasn't available.
+               return;
+       }
+       saved_locale = strdup(saved_locale);
        float data[] = {
                0.0f, 0.0f, 0.0f, 0.0f,
        };