Hi all,

Attached is a simple program to test whether the Win32 API supports BiDi reordering. Some packagers asked me for such a utility in the past, so they can make sure that their inclusion of ICU worked, and without forcing them to actually understand languages that are all Hebrew to them.

I'm not sure whether it would be necessary to include this utility inside the Wine soure, or how to do so. This is not exactly a test, as a failure is totally justified under some circumstances.

Shachar

--
Shachar Shemesh
Open Source integration consultant
Home page & resume - http://www.shemesh.biz/

/*
 * Copyright (C) 2003 Shachar Shemesh
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <stdio.h>
#include <windows.h>

const WCHAR simple_bidi[]={0x5d0, 0x5d1, 0x5d2, 0};

int main()
{
    WCHAR reordered_bidi[5];
    HDC dc=GetDC(NULL);
    GCP_RESULTSW results={ sizeof(GCP_RESULTSW), reordered_bidi, NULL, NULL, NULL, NULL,
        NULL, 0, 0 };

    /* Try to reorder the simple string, and see if things come out the right way */

    GetCharacterPlacementW( dc, simple_bidi, 3, 0, &results, GCP_REORDER );

    if( reordered_bidi[0]==0x5d2 )
    {
        printf("Success\n");
    } else
    {
        printf("Failed\n");
    }

    return 0;
}

Reply via email to