Skip to content

Instantly share code, notes, and snippets.

@mrjoshuak
Created January 22, 2014 01:52
Show Gist options
  • Save mrjoshuak/8552185 to your computer and use it in GitHub Desktop.
Save mrjoshuak/8552185 to your computer and use it in GitHub Desktop.

#TODO

  • One thing c4 rials server with testing.

  • Build new c4 rials server with testing.

  • New Gui Elements

    • Opening Animation
      • logo artwork
        • C4
        • Camera4
      • email/bug report large font quality
      • email/bug report animated image quality.
    • Login
      • animation
      • server interaction
      • local store
    • Register
      • email
      • password confirmation.
    • Image upload with meta data.
    • Image grid display.
    • Image list display.
    • Image item display.
    • Image messages.
    • Share/Send image.
    • Collections grid display.
    • Collections path/list display.
    • Tag List
    • Notifications List
    • Search
      • tags
      • filesname
      • date
      • meta
  • Update unified with new Qt c4 templates.

  • Cleanup Qt Specs code, make OS tool (maybe gem?)

Fix image path space problem.

Async format conversionhh Async uploading Async downloading Restart Uploads Slide tutorial Retain data, retain upload queue Notes Fined users documents folder automatically for cache folder (or system app data folder) add, web admin features auto load Aperture and iPhoto images. Queue commands. light GUI setting Restore image command. tags Image right click context menu: "make project cover image" Automated max/window/linux checkout, build, deploy script Conditional "delete for all" project (if this is the creator, and people are sharing) search New project takes focus when created Intro How to Video. Add, mangoDB Isolated gui development env. prune unused / usefulness signals

#Build

$ qmake ../../clientC4/c4.pro -r -spec macx-clang CONFIG+=x86_64
$ make -j 12

#Notes

###Platform Defines

  • DESIGNER

  • MAC

  • WINDOWS

  • LINUX

  • ANDROID

  • IPHONE

  • IPAD

  • IPADMINI

Ingest images steps: CameraInterface->FileDiologue->Accept ImageView->addImagePaths images.coffee->addImagePaths made default image object. loop over images. get filename. #TODO: if it's already in images, then just add the current project and update. save task. push basic object onto image stack (server id set to -1) imageIngestProcessor->addFile imageIngestProcessor->process ImageIngestEngine::process generateMd5Hash(file) :: emit md5HashGenerated(fileUrl.toString(), hash) generateProxies(file, hash, proxyPath) :: emit proxyGenerated(proxyFile, rez, hash)

md5HashGenerated :: ImageView.onSetMd5Hash registerHash_old add 'original' path #I should do this earlier shouldn't I? set md5_hash

proxyGenerated :: ImageView.onAddProxy addProxy_old update or create Data.local_proxies for the given resolution and hash update imageView if proxy size is "128" update project view if image size is "256" addUpload() for the given hash / rez call Server.getNew callback: receiveUploadInfo

receiveUploadInfo = (requestResponse, image) -> replace 'timestamp' in key string current.getTime() imageUploadProcessor.uploadFile requestResponse, image

Notes:

readelf -d /path/to/exe | grep RPATH

3291359971

// Tools.echo("System Globals: ") // Tools.echo("desktopPath: "+ systemGlobals.desktopPath) // Tools.echo("documentsPath: "+ systemGlobals.documentsPath) // Tools.echo("fontsPath: "+ systemGlobals.fontsPath) // Tools.echo("applicationsPath: "+ systemGlobals.applicationsPath) // Tools.echo("musicPath: "+ systemGlobals.musicPath) // Tools.echo("moviesPath: "+ systemGlobals.moviesPath) // Tools.echo("picturesPath: "+ systemGlobals.picturesPath) // Tools.echo("tempPath: "+ systemGlobals.tempPath) // Tools.echo("homePath: "+ systemGlobals.homePath) // Tools.echo("dataPath: "+ systemGlobals.dataPath) // Tools.echo("cachePath: "+ systemGlobals.cachePath) // Tools.echo("genericCachePath: "+ systemGlobals.genericCachePath) // Tools.echo("genericDataPath: "+ systemGlobals.genericDataPath) // Tools.echo("runtimePath: "+ systemGlobals.runtimePath) // Tools.echo("configPath: "+ systemGlobals.configPath) // Tools.echo("downloadPath: "+ systemGlobals.downloadPath)

#Big picture notes

  • ONE
    • Something
    • Something
    • Something
    • Something
    • Something
  • TWO
    • Something
    • Something
    • Something
    • Something
  • THREE
    • Something
    • Something
    • Something
    • Something
    • Something
    • Something
    • Something
    • Something
    • Something
    • Something
    • Something
  • FOUR
    • Something
    • Something
    • Something
    • Something
    • Something
  • FIVE
    • Something
    • Something
    • Something
    • Something
    • Something
    • Something
    • Something
  • SIX
    • Something
    • Something
    • Something
    • Something
    • Something
    • Something
  • SEVEN
    • Something
    • Something
    • Something

User Something

  • This that and the other
  • This that and the other
  • This that and the other
  • This that and the other
  • This that and the other
  • This that and the other
  • This that and the other
  • This that and the other
  • This that and the other
  • This that and the other

Version 1 Requirements

Components

  • Something
    • Something
      • Something
        • Something
        • Something
        • Something
  • Something
    • Something
      • Something
        • Something
        • Something
        • Something
        • Something
  • Something
    • Something
    • Something
  • Something
    • Something
    • Something
    • Something
    • Something
  • Something
    • Something

###Views

App wide search

  • Something

    • Something - states: (start, error)
    • Something - states: (start, error, success)
    • Something - states: (start, error, success)
    • Something
    • ClientID

      • Something
      • Something
    • UserClientSetting

      • Something
      • Something
    • Share (used to be Invite)

      • Something

      • Something

      • Something

    • Something

  • Image

    • Something
    • Something
    • Something
    • Something
    • Something

      • Something
      • Something
    • Something

      • Something
      • Something
      • Something
    • Something

    • Something

Collection (Use to be project_type and project)

  • Grid
  • Nested List
  • Single
  • Compressed List / Fast Switching (multiple client windows?)

Tag

  • Nested List

Connection(tag, image)

  • Indicator light on images...
  • Multi Tag Selection form Nested List
  • Text field

Relationship(user, user)

  • Show Friends, Coworkers, etc.

Relationship(user, image) Relationship(user, collection)

Not for first version Something

  • Something
  • Something

Something Something Something


#QML Tests (The Secret Docs)

#Organization of test cases

The test cases are launched by a C++ harness that consists of the following code:

#include <QtTestQuick/qdeclarativetest.h>
QTEST_QUICK_MAIN(qmlexample)

Where "qmlexample" is an identifier to use to uniquely identify this set of tests.

The test harness scans recursively for "tst_*.qml" files in the qrc resources that are bound into the test harness binary. The following is an example .qrc file:

<!DOCTYPE RCC><RCC version="1.0">
<qresource>
    <file>tst_basic.qml</file>
    <file>tst_item.qml</file>
</qresource>
</RCC>

The QTEST_QUICK_SOURCE_DIR environment variable can also be set at runtime to run test cases from a non-resource directory.

Other *.qml files may appear for auxillary QML components that are used by the test.

See "tests/qmlexample" for an example of creating a test harness.

Basic test cases

Test cases are written as JavaScript functions within a "TestCase" element:


import Qt 4.7 import QtTest 1.0

TestCase { name: "MathTests"

function test_math() {
    compare(2 + 2, 4, "2 + 2 = 4")
}

function test_fail() {
    compare(2 + 2, 5, "2 + 2 = 5")
}

}

Functions that start with "test_" are treated as test cases to be executed. The "name" is used to prefix the functions in the output:

********* Start testing of MathTests ********* FAIL! : MathTests::test_fail() 2 + 2 = 5: actual: 4, expected: 5 PASS : MathTests::test_math() Totals: 1 passed, 1 failed, 0 skipped ********* Finished testing of MathTests *********

Because of the way JavaScript properties work, the order in which the test functions are found is unpredictable. To assist with predictability, the test framework will sort the functions on ascending order of name. This can help when there are two tests that must be run in order.

A number of helper functions are available to assist with writing tests:

fail(msg)
    - Fail the current test and show "msg".
    - Similar to QFAIL in C++

verify(cond, msg)
    - Verify that "cond" is true, fail with "msg" if not.
    - Similar to QVERIFY in C++

compare(actual, expected, msg)
    - Compare "actual" with "expected", fail with "msg" if not.
    - Similar to QCOMPARE in C++

tryCompare(obj, prop, value[, timeout])
    - Tries comparing the property called "prop" on "obj" with "value".
      If the compare fails, wait for up to "timeout" milliseconds,
      processing Qt events, until the property becomes "value".
    - The default timeout is 5000 milliseconds.
    - e.g. tryCompare(img, "status", BorderImage.Ready)

skip(msg)                   ["Single" mode]
skipAll(msg)
    - Skip the current test and show "msg".
    - Similar to QSKIP in C++

expectFail(msg)             ["Abort" mode]
expectFailContinue(msg)
    - Mark the current test as expected to fail, with "msg" on failure.

warn(msg)
    - Similar to QWARN in C++

ignoreWarning(msg)
    - Ignore warning message
    - Similar to QTest::ignoreMessage(QtWarningMsg, msg)

wait(ms)
    - Wait for "ms" milliseconds, processing Qt events.

sleep(ms)
    - Sleep for "ms" milliseconds, but do not process events.

The "msg" parameters can be omitted if there is no particular message that should be displayed other than "FAIL" or "SKIP".

Special functions

The following special function names have the same meaning as in C++:

initTestCase()
cleanupTestCase()
init()
cleanup()

Note: The initTestCase_data() function from C++ is not supported.

Data-driven tests

Table data can be provided to a test using a function name that ends with "_data":


import Qt 4.7 import QtTest 1.0

TestCase { name: "DataTests"

function test_table_data() {
    return [
        {tag: "2 + 2 = 4", a: 2, b: 2, answer: 4 },
        {tag: "2 + 6 = 8", a: 2, b: 6, answer: 8 },
    ]
}

function test_table(data) {
    compare(data.a + data.b, data.answer)
}

}

The test framework will iterate over all of the rows in the table and pass each row to the test function. As shown, the columns can be extracted for use in the test. The "tag" column is special - it is printed by the test framework when a row fails, to help the reader identify which case failed amongst a set of otherwise passing tests.

Asynchronous testing

The easiest method for asynchronous testing is to use tryCompare() to wait for a property to transition to an expected value. For example:

tryCompare(img, "status", BorderImage.Ready)
compare(img.width, 120)
compare(img.height, 120)
compare(img.horizontalTileMode, BorderImage.Stretch)
compare(img.verticalTileMode, BorderImage.Stretch)

The "when" property can be used to cause a "TestCase" element to trigger only when a certain condition is true. For example, the following example runs a test when the user presses the mouse button:


import Qt 4.7 import QtTest 1.0

Rectangle { id: foo width: 640; height: 480 color: "cyan"

MouseArea {
    id: area
    anchors.fill: parent
}

property bool bar: true

TestCase {
    name: "ItemTests"
    when: area.pressed
    id: test1

    function test_bar() {
        verify(bar)
    }
}

}

Multiple "TestCase" elements can be supplied. The test program will exit once they have all completed. If a test case doesn't need to run (because a precondition has failed), then "optional" can be set to true:


TestCase { when: false optional: true

function test_not_run() {
    verify(false)
}

}

from qt-labs/skwoks-qtest-qml(testcases.txt)[https://qt.gitorious.net/qt-labs/skwoks-qtest-qml/source/27dfe1fb63977807c9c0a430e778a06290d4f4a4:doc/testcases.txt]

#DONE

[done] - Create Installer for linux [done] - Fix selection and zoom [done] - TaskQueue db object [done] - Async hashing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment