~ubuntu-branches/ubuntu/precise/wine1.3/precise

« back to all changes in this revision

Viewing changes to dlls/shlwapi/tests/ordinal.c

  • Committer: Package Import Robot
  • Author(s): Scott Ritchie
  • Date: 2012-01-17 09:00:34 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120117090034-eyhpp02jawlvrrkc
Tags: 1.3.37-0ubuntu1
* New upstream release
  - Many changes
* Convert to 3.0 source format
* debian/control:
  - Remove pre-multiarch amd64 build depends
  - Remove quilt build depends
  - Recommend proper gecko versions
* debian/rules:
  - Remove manual dh_quilt patch and unpatch
  - No need to uuencode/uudecode anymore with new source format

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
static HRESULT (WINAPI *pSKSetValueW)(DWORD, LPCWSTR, LPCWSTR, DWORD, void*, DWORD);
68
68
static HRESULT (WINAPI *pSKDeleteValueW)(DWORD, LPCWSTR, LPCWSTR);
69
69
static HRESULT (WINAPI *pSKAllocValueW)(DWORD, LPCWSTR, LPCWSTR, DWORD*, void**, DWORD*);
 
70
static HWND    (WINAPI *pSHSetParentHwnd)(HWND, HWND);
70
71
 
71
72
static HMODULE hmlang;
72
73
static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT);
2853
2854
    hkey = pSHGetShellKey(SHKEY_Root_HKLM, WineTestW, FALSE);
2854
2855
    ok(hkey == NULL, "hkey != NULL\n");
2855
2856
 
 
2857
    hkey = pSHGetShellKey(SHKEY_Root_HKLM, NULL, FALSE);
 
2858
    ok(hkey != NULL, "Can't open key\n");
 
2859
    ok(SUCCEEDED(RegDeleteKeyW(hkey, WineTestW)), "Can't delete key\n");
 
2860
    RegCloseKey(hkey);
 
2861
 
2856
2862
    hkey = pSHGetShellKey(SHKEY_Root_HKLM, WineTestW, TRUE);
2857
 
    ok(hkey != NULL, "Can't create key\n");
2858
 
    RegCloseKey(hkey);
2859
 
 
2860
 
    hkey = pSHGetShellKey(SHKEY_Root_HKLM, NULL, FALSE);
2861
 
    ok(hkey != NULL, "Can't create key\n");
2862
 
    ok(SUCCEEDED(RegDeleteKeyW(hkey, WineTestW)), "Can't delte key\n");
 
2863
    if (!hkey && GetLastError() == ERROR_ACCESS_DENIED)
 
2864
    {
 
2865
        skip("Not authorized to create keys\n");
 
2866
        return;
 
2867
    }
 
2868
    ok(hkey != NULL, "Can't create key\n");
2863
2869
    RegCloseKey(hkey);
2864
2870
 
2865
2871
    if (!pSKGetValueW || !pSKSetValueW || !pSKDeleteValueW || !pSKAllocValueW)
2868
2874
        return;
2869
2875
    }
2870
2876
 
 
2877
    size = sizeof(data);
2871
2878
    hres = pSKGetValueW(SHKEY_Root_HKLM, WineTestW, NULL, NULL, &data, &size);
2872
2879
    ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hres = %x\n", hres);
2873
2880
 
2906
2913
 
2907
2914
    hkey = pSHGetShellKey(SHKEY_Root_HKLM, NULL, FALSE);
2908
2915
    ok(hkey != NULL, "Can't create key\n");
2909
 
    ok(SUCCEEDED(RegDeleteKeyW(hkey, WineTestW)), "Can't delte key\n");
 
2916
    ok(SUCCEEDED(RegDeleteKeyW(hkey, WineTestW)), "Can't delete key\n");
2910
2917
    RegCloseKey(hkey);
2911
2918
}
2912
2919
 
2919
2926
    MAKEFUNC(SHFreeShared, 10);
2920
2927
    MAKEFUNC(GetAcceptLanguagesA, 14);
2921
2928
    MAKEFUNC(SHSetWindowBits, 165);
 
2929
    MAKEFUNC(SHSetParentHwnd, 167);
2922
2930
    MAKEFUNC(ConnectToConnectionPoint, 168);
2923
2931
    MAKEFUNC(SHSearchMapInt, 198);
2924
2932
    MAKEFUNC(SHCreateWorkerWindowA, 257);
2943
2951
#undef MAKEFUNC
2944
2952
}
2945
2953
 
 
2954
static void test_SHSetParentHwnd(void)
 
2955
{
 
2956
    HWND hwnd, hwnd2, ret;
 
2957
    DWORD style;
 
2958
 
 
2959
    if (!pSHSetParentHwnd)
 
2960
    {
 
2961
        win_skip("SHSetParentHwnd not available\n");
 
2962
        return;
 
2963
    }
 
2964
 
 
2965
    hwnd = CreateWindowA("Button", "", WS_VISIBLE, 0, 0, 10, 10, NULL, NULL, NULL, NULL);
 
2966
    ok(hwnd != NULL, "got %p\n", hwnd);
 
2967
 
 
2968
    hwnd2 = CreateWindowA("Button", "", WS_VISIBLE | WS_CHILD, 0, 0, 10, 10, hwnd, NULL, NULL, NULL);
 
2969
    ok(hwnd2 != NULL, "got %p\n", hwnd2);
 
2970
 
 
2971
    /* null params */
 
2972
    ret = pSHSetParentHwnd(NULL, NULL);
 
2973
    ok(ret == NULL, "got %p\n", ret);
 
2974
 
 
2975
    /* set to no parent while already no parent present */
 
2976
    ret = GetParent(hwnd);
 
2977
    ok(ret == NULL, "got %p\n", ret);
 
2978
    style = GetWindowLongA(hwnd, GWL_STYLE);
 
2979
    ok((style & (WS_POPUP|WS_CHILD)) == 0, "got style 0x%08x\n", style);
 
2980
    ret = pSHSetParentHwnd(hwnd, NULL);
 
2981
    ok(ret == NULL, "got %p\n", ret);
 
2982
    style = GetWindowLongA(hwnd, GWL_STYLE);
 
2983
    ok((style & (WS_POPUP|WS_CHILD)) == 0, "got style 0x%08x\n", style);
 
2984
 
 
2985
    /* reset to null parent from not null */
 
2986
    ret = GetParent(hwnd2);
 
2987
    ok(ret == hwnd, "got %p\n", ret);
 
2988
    style = GetWindowLongA(hwnd2, GWL_STYLE);
 
2989
    ok((style & (WS_POPUP|WS_CHILD)) == WS_CHILD, "got style 0x%08x\n", style);
 
2990
    ret = pSHSetParentHwnd(hwnd2, NULL);
 
2991
    ok(ret == NULL, "got %p\n", ret);
 
2992
    style = GetWindowLongA(hwnd2, GWL_STYLE);
 
2993
    ok((style & (WS_POPUP|WS_CHILD)) == WS_POPUP, "got style 0x%08x\n", style);
 
2994
    ret = GetParent(hwnd2);
 
2995
    ok(ret == NULL, "got %p\n", ret);
 
2996
 
 
2997
    /* set parent back */
 
2998
    style = GetWindowLongA(hwnd2, GWL_STYLE);
 
2999
    SetWindowLongA(hwnd2, GWL_STYLE, style & ~(WS_CHILD|WS_POPUP));
 
3000
    style = GetWindowLongA(hwnd2, GWL_STYLE);
 
3001
    ok((style & (WS_CHILD|WS_POPUP)) == 0, "got 0x%08x\n", style);
 
3002
 
 
3003
    ret = pSHSetParentHwnd(hwnd2, hwnd);
 
3004
    todo_wine ok(ret == NULL, "got %p\n", ret);
 
3005
 
 
3006
    style = GetWindowLongA(hwnd2, GWL_STYLE);
 
3007
    ok((style & (WS_POPUP|WS_CHILD)) == WS_CHILD, "got style 0x%08x\n", style);
 
3008
    ret = GetParent(hwnd2);
 
3009
    ok(ret == hwnd, "got %p\n", ret);
 
3010
 
 
3011
    /* try to set same parent again */
 
3012
    /* with WS_POPUP */
 
3013
    style = GetWindowLongA(hwnd2, GWL_STYLE);
 
3014
    SetWindowLongA(hwnd2, GWL_STYLE, style | WS_POPUP);
 
3015
    ret = pSHSetParentHwnd(hwnd2, hwnd);
 
3016
    todo_wine ok(ret == NULL, "got %p\n", ret);
 
3017
    style = GetWindowLongA(hwnd2, GWL_STYLE);
 
3018
    ok((style & (WS_CHILD|WS_POPUP)) == WS_CHILD, "got 0x%08x\n", style);
 
3019
    ret = GetParent(hwnd2);
 
3020
    ok(ret == hwnd, "got %p\n", ret);
 
3021
 
 
3022
    /* without WS_POPUP */
 
3023
    style = GetWindowLongA(hwnd2, GWL_STYLE);
 
3024
    SetWindowLongA(hwnd2, GWL_STYLE, style | ~WS_POPUP);
 
3025
    ret = pSHSetParentHwnd(hwnd2, hwnd);
 
3026
    todo_wine ok(ret == hwnd, "got %p\n", ret);
 
3027
    style = GetWindowLongA(hwnd2, GWL_STYLE);
 
3028
    ok((style & (WS_CHILD|WS_POPUP)) == WS_CHILD, "got 0x%08x\n", style);
 
3029
    ret = GetParent(hwnd2);
 
3030
    ok(ret == hwnd, "got %p\n", ret);
 
3031
 
 
3032
    DestroyWindow(hwnd);
 
3033
    DestroyWindow(hwnd2);
 
3034
}
 
3035
 
2946
3036
START_TEST(ordinal)
2947
3037
{
2948
3038
    hShlwapi = GetModuleHandleA("shlwapi.dll");
2982
3072
    test_SHGetIniString();
2983
3073
    test_SHSetIniString();
2984
3074
    test_SHGetShellKey();
 
3075
    test_SHSetParentHwnd();
2985
3076
 
2986
3077
    FreeLibrary(hshell32);
2987
3078
    FreeLibrary(hmlang);