~ubuntu-branches/ubuntu/raring/plasma-mobile/raring-proposed

« back to all changes in this revision

Viewing changes to applications/settings/modules/configtest/contents/ui/testhelper.js

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-07-17 12:04:43 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120717120443-q3ig9u2fnltx67yg
Tags: 2.0+git2012071701-0ubuntu1
* New upstream snapshot
* Remove build-dep on kde-runtime-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function runTest(label, condition1, condition2) {
 
2
    var rtxt = "";
 
3
    if (condition1 == condition2) {
 
4
        rtxt += "\n<font color=\"green\"> Success</font> <em>" + label + "</em> : (" + condition1 + ")";
 
5
    } else {
 
6
        rtxt += "\n<font color=\"red\"> Failed</font> <em>" + label + "</em> :(" + condition1 + " != " + condition2 + ")";
 
7
    }
 
8
    rtxt += "<br/>";
 
9
    return rtxt;
 
10
}
 
11
 
 
12
function defaultValues() {
 
13
    // Fill the example config with default values
 
14
 
 
15
    // This serves as example how you can write data in a somewhat type-safe manner
 
16
    // into a KConfigGroup
 
17
 
 
18
    // String -> QString
 
19
    configGroup.writeEntry("fakeString", "Some _fake_ string.");
 
20
 
 
21
    // Url -> QUrl (FIXME)
 
22
    configGroup.writeEntry("fakeUrl", Url("http://planetkde.org"));
 
23
 
 
24
    // bool
 
25
    configGroup.writeEntry("fakeBool", true);
 
26
 
 
27
    // int
 
28
    configGroup.writeEntry("fakeInt", 23);
 
29
 
 
30
    // real
 
31
    configGroup.writeEntry("fakeReal", 1.87);
 
32
 
 
33
    // point, using the QML basic type point
 
34
    configGroup.writeEntry("fakePoint", Qt.point(30,40));
 
35
 
 
36
    // rect, using the QML basic type rect
 
37
    configGroup.writeEntry("fakeRect", Qt.rect(12, 24, 600, 400));
 
38
 
 
39
    // Date -> QDateTime
 
40
    configGroup.writeEntry("fakeDateTime", new Date(2003, 12, 27, 13, 37, 17));
 
41
    print(" == " + new Date(2003, 9, 27, 13, 37, 17).toUTCString());
 
42
 
 
43
    // date -> QDateTime
 
44
    //configGroup.writeEntry("fakeDate", Qt.date("2003-09-27"));
 
45
 
 
46
    // list<Type> -. QVariantList (FIXME)
 
47
    configGroup.writeEntry("fakeList", ["one", "two", "three" ]);
 
48
}
 
49
 
 
50
function convertDate(d) {
 
51
    var splitDate = d.toString().split(',');
 
52
    print(" out of config: " + d.toString());
 
53
    var someday = new Date(splitDate[0], splitDate[1], splitDate[2], splitDate[3], splitDate[4], splitDate[5]);
 
54
    print (" ....." + someday.valueOf());
 
55
    return someday;
 
56
}