]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/slider_decibels.qc
Merge branch 'master' into Mirio/balance
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / slider_decibels.qc
index e577cba66407ce84db002f16a1d7c860e7a7a365..2b78141383d28579d157c5d583addf039427f90d 100644 (file)
@@ -1,16 +1,4 @@
-#ifndef SLIDER_DECIBELS_H
-#define SLIDER_DECIBELS_H
-#include "slider.qc"
-CLASS(XonoticDecibelsSlider, XonoticSlider)
-       METHOD(XonoticDecibelsSlider, loadCvars, void(entity));
-       METHOD(XonoticDecibelsSlider, saveCvars, void(entity));
-       METHOD(XonoticDecibelsSlider, valueToText, string(entity, float));
-ENDCLASS(XonoticDecibelsSlider)
-entity makeXonoticDecibelsSlider_T(float, float, float, string, string);
-entity makeXonoticDecibelsSlider(float, float, float, string);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "slider_decibels.qh"
 
 float toDecibelOfSquare(float f, float mi)
 {
@@ -94,19 +82,18 @@ string XonoticDecibelsSlider_valueToText(entity me, float v)
                return sprintf(_("%s dB"), ftos_decimals(toDecibelOfSquare(fromDecibelOfSquare(v, me.valueMin), 0), me.valueDigits));
 }
 
-void _TEST_XonoticDecibelsSlider()
+bool autocvar_test_XonoticDecibelsSlider = false;
+TEST(XonoticDecibelsSlider, SoundTest)
 {
-       float i;
-       for(i = -400; i < 0; ++i)
+       if (!autocvar_test_XonoticDecibelsSlider) { SUCCEED(); return; }
+       for (int i = -400; i < 0; ++i)
        {
                float db = i * 0.1;
                float v = fromDecibelOfSquare(db, -40);
                float dbv = toDecibelOfSquare(v, -40);
                float d = dbv - db;
                LOG_INFOF("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d);
-               TEST_Check(fabs(d) > 0.02);
+               EXPECT_GT(fabs(d), 0.02);
        }
-       TEST_OK();
+       SUCCEED();
 }
-
-#endif