[PATCH] [quartz] - add initial tests for DBToAmpFactor and AmpFactorToDB
Vijay Kiran Kamuju
infyquest at gmail.com
Fri Jan 12 12:34:24 CST 2018
For Bug #44268
Based on patch from Robert Reif
Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
---
dlls/quartz/tests/misc.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/dlls/quartz/tests/misc.c b/dlls/quartz/tests/misc.c
index 748c0f2cfd39..780447d4a6ae 100644
--- a/dlls/quartz/tests/misc.c
+++ b/dlls/quartz/tests/misc.c
@@ -41,6 +41,47 @@
ok(refCount == num, "IUnknown_Release should return %d, got %d\n", num, refCount); \
}
+static LONG (WINAPI *pAmpFactorToDB)(LONG);
+static LONG (WINAPI *pDBToAmpFactor)(LONG);
+
+struct sndconv {
+LONG amp;
+LONG db;
+};
+
+static const struct sndconv amp_db[] = {
+ {-65535,0},
+ {-1,0},
+ {0,-9640},
+ {1,-9630},
+ {2,-9030},
+ {3,-8670},
+ {5,-8230},
+ {10,-7630},
+ {25,-6830},
+ {50,-6230},
+ {75,-5880},
+ {100,-5630},
+ {159,-5230},
+ {1000,-3630},
+ {10000,-1630},
+ {32767,-600},
+ {32768,-600},
+ {65435,0},
+ {65535,0},
+ {65536,0},
+ {100000,0}
+};
+
+static const struct sndconv db_amp[] = {
+ {65535,-1},
+ {32845,-600},
+ {825,-3800},
+ {100,-5630},
+ {0,-9640},
+ {0,-10000}
+};
+
static void test_aggregation(const CLSID clsidOuter, const CLSID clsidInner,
const IID iidOuter, const IID iidInner)
{
@@ -220,8 +261,41 @@ static void test_filter_mapper_aggregations(void)
}
}
+static void test_ampfactortodb(void)
+{
+ LONG dbval;
+ int i;
+
+ for (i=0; i<sizeof(amp_db)/sizeof(struct sndconv); i++)
+ {
+ dbval = pAmpFactorToDB(amp_db[i].amp);
+ todo_wine ok(dbval == amp_db[i].db, "for %d expected %d got %d\n", amp_db[i].amp, amp_db[i].db, dbval);
+ }
+}
+
+static void test_dbtoampfactor(void)
+{
+ LONG ampval;
+ int i;
+
+ for (i=0; i<sizeof(db_amp)/sizeof(struct sndconv); i++)
+ {
+ ampval = pDBToAmpFactor(db_amp[i].db);
+ todo_wine ok(ampval == db_amp[i].amp, "for %d expected %d got %d\n", db_amp[i].db, amp_db[i].amp, ampval);
+ }
+}
+
START_TEST(misc)
{
+ HMODULE hquartz;
+
+ hquartz = LoadLibraryA("quartz.dll");
+ pAmpFactorToDB = (void *)GetProcAddress(hquartz,"AmpFactorToDB");
+ pDBToAmpFactor = (void *)GetProcAddress(hquartz,"DBToAmpFactor");
+
+ test_ampfactortodb();
+ test_dbtoampfactor();
+
CoInitialize(NULL);
test_null_renderer_aggregations();
--
2.15.1
More information about the wine-patches
mailing list