https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d2c4626d98ce456d874f1…
commit d2c4626d98ce456d874f17e9c34dcd5d7b9106f3
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Mar 13 00:16:41 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:28:12 2022 +0100
[WINESYNC] msi/tests: Add more tests for MSIMODIFY_ASSIGN.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 0628a7c8bf43388a3c2d14ec5d57566921ef436c by Zebediah Figura
<z.figura12(a)gmail.com>
---
modules/rostests/winetests/msi/db.c | 172 +++++++++++++++++++++++++++++++++---
1 file changed, 160 insertions(+), 12 deletions(-)
diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c
index bcde840bd83..e59846ffad7 100644
--- a/modules/rostests/winetests/msi/db.c
+++ b/modules/rostests/winetests/msi/db.c
@@ -5176,12 +5176,7 @@ static void test_viewmodify_assign(void)
ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n");
-
- r = MsiRecordGetInteger(hrec, 1);
- ok(r == 1, "Expected 1, got %d\n", r);
- r = MsiRecordGetInteger(hrec, 2);
- ok(r == 2, "Expected 2, got %d\n", r);
-
+ check_record(hrec, 2, "1", "2");
r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "failed to close record\n");
@@ -5226,12 +5221,7 @@ static void test_viewmodify_assign(void)
ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n");
-
- r = MsiRecordGetInteger(hrec, 1);
- ok(r == 1, "Expected 1, got %d\n", r);
- r = MsiRecordGetInteger(hrec, 2);
- ok(r == 4, "Expected 4, got %d\n", r);
-
+ check_record(hrec, 2, "1", "4");
r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "failed to close record\n");
@@ -5243,6 +5233,164 @@ static void test_viewmodify_assign(void)
r = MsiCloseHandle(hview);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
+ r = run_query(hdb, 0, "CREATE TABLE `table2` (`A` INT, `B` INT, `C` INT, `D` INT
PRIMARY KEY `A`,`B`)");
+ ok(!r, "got %u\n", r);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `table2`", &hview);
+ ok(!r, "got %u\n", r);
+ r = MsiViewExecute(hview, 0);
+ ok(!r, "got %u\n", r);
+
+ hrec = MsiCreateRecord(4);
+ MsiRecordSetInteger(hrec, 1, 1);
+ MsiRecordSetInteger(hrec, 2, 2);
+ MsiRecordSetInteger(hrec, 3, 3);
+ MsiRecordSetInteger(hrec, 4, 4);
+ r = MsiViewModify(hview, MSIMODIFY_ASSIGN, hrec);
+ ok(!r, "got %u\n", r);
+ MsiCloseHandle(hrec);
+
+ MsiCloseHandle(hview);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `table2`", &hview);
+ ok(!r, "got %u\n", r);
+ r = MsiViewExecute(hview, 0);
+ ok(!r, "got %u\n", r);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "1", "2", "3", "4");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(r == ERROR_NO_MORE_ITEMS, "got %u\n", r);
+ MsiCloseHandle(hview);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `table2`", &hview);
+ ok(!r, "got %u\n", r);
+ r = MsiViewExecute(hview, 0);
+ ok(!r, "got %u\n", r);
+
+ hrec = MsiCreateRecord(4);
+ MsiRecordSetInteger(hrec, 1, 1);
+ MsiRecordSetInteger(hrec, 2, 4);
+ MsiRecordSetInteger(hrec, 3, 3);
+ MsiRecordSetInteger(hrec, 4, 3);
+ r = MsiViewModify(hview, MSIMODIFY_ASSIGN, hrec);
+ ok(!r, "got %u\n", r);
+ MsiCloseHandle(hrec);
+
+ MsiCloseHandle(hview);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `table2`", &hview);
+ ok(!r, "got %u\n", r);
+ r = MsiViewExecute(hview, 0);
+ ok(!r, "got %u\n", r);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "1", "2", "3", "4");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "1", "4", "3", "3");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(r == ERROR_NO_MORE_ITEMS, "got %u\n", r);
+ MsiCloseHandle(hview);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT `B`, `C` FROM `table2`",
&hview);
+ ok(!r, "got %u\n", r);
+ r = MsiViewExecute(hview, 0);
+ ok(!r, "got %u\n", r);
+
+ hrec = MsiCreateRecord(2);
+ MsiRecordSetInteger(hrec, 1, 2);
+ MsiRecordSetInteger(hrec, 2, 4);
+ r = MsiViewModify(hview, MSIMODIFY_ASSIGN, hrec);
+ ok(!r, "got %u\n", r);
+ MsiRecordSetInteger(hrec, 1, 3);
+ r = MsiViewModify(hview, MSIMODIFY_ASSIGN, hrec);
+ ok(!r, "got %u\n", r);
+ MsiCloseHandle(hrec);
+
+ MsiCloseHandle(hview);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `table2` ORDER BY `A`",
&hview);
+ ok(!r, "got %u\n", r);
+ r = MsiViewExecute(hview, 0);
+ ok(!r, "got %u\n", r);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "", "2", "4", "");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "", "3", "4", "");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "1", "2", "3", "4");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "1", "4", "3", "3");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(r == ERROR_NO_MORE_ITEMS, "got %u\n", r);
+ MsiCloseHandle(hview);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT `A`, `B`, `C` FROM `table2`",
&hview);
+ ok(!r, "got %u\n", r);
+ r = MsiViewExecute(hview, 0);
+ ok(!r, "got %u\n", r);
+
+ hrec = MsiCreateRecord(3);
+ MsiRecordSetInteger(hrec, 1, 1);
+ MsiRecordSetInteger(hrec, 2, 2);
+ MsiRecordSetInteger(hrec, 3, 5);
+ r = MsiViewModify(hview, MSIMODIFY_ASSIGN, hrec);
+ ok(!r, "got %u\n", r);
+ MsiCloseHandle(hrec);
+
+ MsiCloseHandle(hview);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `table2` ORDER BY `A`",
&hview);
+ ok(!r, "got %u\n", r);
+ r = MsiViewExecute(hview, 0);
+ ok(!r, "got %u\n", r);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "", "2", "4", "");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "", "3", "4", "");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "1", "2", "5", "");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(!r, "got %u\n", r);
+ check_record(hrec, 4, "1", "4", "3", "3");
+ MsiCloseHandle(hrec);
+
+ r = MsiViewFetch(hview, &hrec);
+ ok(r == ERROR_NO_MORE_ITEMS, "got %u\n", r);
+ MsiCloseHandle(hview);
+
/* close database */
r = MsiCloseHandle( hdb );
ok(r == ERROR_SUCCESS, "MsiOpenDatabase close failed\n");