是否有人在shell中看到过,试图实现或以其他方式使用TAP?我们正在寻找跨多种语言创建单元测试(不要让我开始为什么到目前为止还没有这个),而且由于我们有很多Perl代码,我们将会关注TAP(其中包括I)想像).我找到了一个用于C的TAP库,Perl,当然,内置它,我甚至找到了一个Java的API.但缺少的一个方面是shell脚本测试.
并非我在单元测试shell脚本上发现了很多,但由于我们确实有数千行shell代码,所以能够以某种方式测试它会很好.
Jquery-mobile支持以下事件:
http://jquerymobile.com/demos/1.0a3/docs/api/events.html
如何在移动设备上获取点击事件(例如图像内)的位置?
$('#myimg').bind('tap', function(e){
var x = ???;
var y = ???;
alert([x, y]);
})
Run Code Online (Sandbox Code Playgroud) 我想为一个简单的UIView做一个手势识别器:
UIView *theView = [[UIView alloc] initWithFrame:rect];
[theView setUserInteractionEnabled:YES];
UITapGestureRecognizer *tap = [[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleTap)] autorelease];
[theView addGestureRecognizer:tap];
Run Code Online (Sandbox Code Playgroud)
如果我调试视图的属性gestureRecognizers,它会显示手势识别器对象.但是当我点击视图内部时,它不起作用.
使用UIImageView的相同代码完美无缺,任何想法为什么在UIView中不起作用?
更新:
一个示例类.
@implementation ExampleClass
- (UIView *)getViewInRect:(CGRect)rect
{
UIView *theView = [[UIView alloc] initWithRect:rect];
[theView setUserInteractionEnabled:YES];
UITapGestureRecognizer *tap = [[[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleTap)]
autorelease];
[aText addGestureRecognizer:tap];
return theView;
}
- (UIImageView *)getImageViewInRect:(CGRect)rect
{
UIImageView *theView = [[UIImageView alloc] initWithRect:rect];
[theView setUserInteractionEnabled:YES];
UITapGestureRecognizer *tap = [[[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleTap)]
autorelease];
[theView addGestureRecognizer:tap];
return [theView autorelease];
}
- (void)handleTap
{
NSLog(@"Tap …Run Code Online (Sandbox Code Playgroud) 我正在使用jquery mobile beta和jquery 1.6.在ipod touch上,滑动事件也会触发tap事件.这个问题不是在Android设备上.我试图谷歌解决方案,但看起来没有很多同样的问题.我有什么非常基本的东西吗?
$("div.totapandswipe").bind('tap',function(event, ui){
alert('event');
});
$("div.totapandswipe").bind('swipe',function(event, ui){
alert('event');
});
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助!
我正在尝试开发一个功能,其中单击一个项目将调用Intent转到另一个Activity,并且长按或双击该项目会执行其他操作,例如允许您编辑文本.
到目前为止,我只能在同一时间发生这两种情况,但不能单独发生.有没有人有任何想法?
public boolean onTouchEvent(MotionEvent e) {
return gestureScanner.onTouchEvent(e);
}
public boolean onSingleTapConfirmed(MotionEvent e) {
Intent i = new Intent(getContext(), SecondClass.class);
getContext().startActivity(i);
return true;
}
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return false; }
public void onLongPress(MotionEvent e) {
Toast.makeText(getContext(), "Edit feature here", Toast.LENGTH_SHORT).show();
}
Run Code Online (Sandbox Code Playgroud) 我的cpanTAP::Formatter::HTML安装挂起,01_basic.t我不知道为什么:
CPAN.pm: Going to build S/SP/SPURKIS/TAP-Formatter-HTML-0.09.tar.gz
# running Build.PL --installdirs site
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'TAP-Formatter-HTML' version '0.09'
C:\Perl\bin\perl.exe Build --makefile_env_macros 1
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc …Run Code Online (Sandbox Code Playgroud) 我现在已经发现如何在OS X上以低级别挂机/点击键盘事件:如何在MacBook键盘上点击(挂钩)F7到F12和Power/Eject
从该答案中打印出代码:
// compile and run from the commandline with:
// clang -framework coreFoundation -framework IOKit ./HID.c -o hid
// sudo ./hid
// This code works with the IOHID library to get notified of keys.
// Still haven't figured out how to truly intercept with
// substitution.
#include <IOKit/hid/IOHIDValue.h>
#include <IOKit/hid/IOHIDManager.h>
void myHIDKeyboardCallback( void* context, IOReturn result, void* sender, IOHIDValueRef value )
{
IOHIDElementRef elem = IOHIDValueGetElement( value );
if (IOHIDElementGetUsagePage(elem) != 0x07)
return;
uint32_t scancode = IOHIDElementGetUsage( …Run Code Online (Sandbox Code Playgroud) 如果我有一个抛出错误的函数并且我想测试该错误,我会写这样的东西:
test('throws at something that is not a string', t => {
t.plan(1)
t.err(loadString(9))
})
Run Code Online (Sandbox Code Playgroud)
但这总是导致执行时来自函数的实际错误:
还有的在not ok 1 no plan found和not ok 2 no assertions found,这也是奇怪的.我怎样才能确定它实际上没有扔?
我需要设置具有多个字形的单个散景图,并且只有字形的子集应该是可选的(即,在鼠标单击某些字形后触发操作)。经过多次试验和错误,我找到了一种将字形的 nonselection_glyph 属性设置为 None 的方法(请参见下面的代码)。这是将字形设置为不可选择(或在选择后禁用更改)的最有效方法吗?
from bokeh.plotting import figure, curdoc
from bokeh.layouts import column
from bokeh.models import ColumnDataSource
TOOLS = "tap"
p = figure(title="Some Figure", tools=TOOLS)
patches_source = ColumnDataSource(dict(x=[[1, 3, 2], [3, 4, 6, 6]], y=[[2, 1, 4], [4, 7, 8, 5]], alphas = [0.8, 0.3], colors=["firebrick", "navy"], name=['A', 'B']))
circles_source = ColumnDataSource(dict(x=[5, 7, 6], y=[2, 1, 4], alphas = [1.0, 1.0, 1.0], colors=["firebrick", "navy", "greeb"], name=['A', 'B', 'C']))
cglyph = p.circle(x='x', y='y', source=circles_source, size=25, line_width=2, alpha = 'alphas', color='colors') …Run Code Online (Sandbox Code Playgroud) 我试图在Windows 7上使用带有活动状态Perl的prove/TAP :: Harness获得颜色(颜色)输出.
实际测试运行良好,只是没有颜色输出.
使用Strawberry Perl和WinXP我遇到了类似的问题.
我无法使用*nix和cygwin或其他第三方xterm,它们都会对输出进行着色.
我知道这有点挑剔,但我想我已经沉迷于"绿色":-)
有一个简单的解决方案吗? - 在Activate状态站点上看不到任何内容 - 我正在考虑提出错误.有关调试或检查的任何指导?
是否值得编写自己的格式化程序?
在此先感谢您的帮助.
尝试安装模块和方法的更多细节......
这些都是根据我的知识安装的
Win32::Console::ANSI;
Term::ANSIColor;
Run Code Online (Sandbox Code Playgroud)
此测试脚本有效:
#!/usr/bin/perl
use strict;
use warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
print "One fish\n";
print "Two fish\n";
print color("red"), "Red Fish\n", color("reset");
print color("blue"), "Blue Fish\n", color("reset");
Run Code Online (Sandbox Code Playgroud)
我试过了:
prove
prove -c
Run Code Online (Sandbox Code Playgroud)
并使用以下测试工具程序有和没有格式化程序但我在假设颜色默认情况下打开.
#!/usr/bin/perl
use strict;
use warnings;
use TAP::Harness;
my @tests = glob( 't/*.t' );
my $harness = TAP::Harness->new();
$harness->runtests( @tests );
Run Code Online (Sandbox Code Playgroud)
我还安装了HTML格式化程序,似乎正在运行.
prove --formatter=TAP::Formatter::HTML
Run Code Online (Sandbox Code Playgroud)
运行:
prove --formatter=TAP::Formatter::Color
Run Code Online (Sandbox Code Playgroud)
Gives无法通过x:/Perl/site/lib/TAP/Harness.pm第679行的"TAP :: Formatter …
tap ×10
jquery ×2
perl ×2
android ×1
bokeh ×1
command-line ×1
cpan ×1
events ×1
hook ×1
iokit ×1
iphone ×1
listener ×1
macos ×1
mobile ×1
node.js ×1
node.js-tape ×1
objective-c ×1
position ×1
python ×1
python-3.x ×1
shell ×1
swipe ×1
tap-harness ×1
tdd ×1
testing ×1
unit-testing ×1